/**
 * css/overrides/responsive.css
 * Responsive design: mobile-first breakpoints
 */

/* =============================================================================
   ALL MOBILE DEVICES (≤ 767px) - Shared rules for XS and S
   ============================================================================= */
@media (max-width: 767px) {
    /* Header */
    .header-content {
        flex-wrap: wrap;
    }

    .nav {
        order: 3;
        width: fit-content;
    }

    /* Hero */
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
    }

    /* Interview header */
    .interview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.625rem;
    }

    .int-info {
        flex-wrap: wrap;
        min-width: 0;
        flex: none;
    }

    .int-stats {
        justify-content: flex-start;
    }

    .stat {
        text-align: left;
    }

    .interview-header-buttons {
        width: 100%;
    }

    .interview-header-buttons .btn {
        flex: 1;
    }

    .interviewer-selector {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    /* Interview layout */
    .interview-main {
        flex: 1;
        flex-direction: column;
        overflow: hidden;
    }

    .chat-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .chat-messages {
        flex: 1;
        overflow-y: auto;
    }

    /* Response area */
    .response-controls {
        flex-direction: column;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .response-buttons {
        flex-direction: row;
        width: 100%;
    }

    .response-buttons .btn,
    .skip-btn {
        flex: 1;
    }

    /* Feedback */
    .score-card {
        flex-direction: column;
    }

    .question-feedback-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .question-nav-buttons {
        width: 100%;
        justify-content: space-between;
    }

    /* Prepare */
    .interviewer-fields {
        grid-template-columns: 1fr;
    }

    .options-row {
        flex-direction: column;
    }

    /* History */
    .history-item-main {
        flex-wrap: wrap;
    }

    .history-item-score {
        order: -1;
        margin-left: auto;
    }

    .history-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .history-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-footer-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Share */
    .share-link-container {
        flex-direction: column;
    }

    .share-social-buttons {
        flex-direction: column;
    }

    .share-social-btn {
        justify-content: center;
    }

    /* Modal */
    .modal-lg {
        min-width: auto;
    }
}

/* =============================================================================
   EXTRA SMALL DEVICES (< 480px)
   ============================================================================= */
@media (max-width: 479px) {
    html {
        font-size: 14px;
    }

    .header-content {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .logo-text {
        font-size: 1.125rem;
    }

    .nav {
        margin: 0.5rem auto 0;
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .lang-select {
        padding: 0.4rem 0.625rem;
        padding-right: 1.5rem;
        font-size: 0.8rem;
    }

    .section {
        padding: 1rem 0.75rem;
        padding-bottom: 80px;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Hero */
    .hero {
        gap: 2rem;
        padding: 1.5rem 0;
        min-height: auto;
    }

    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-card {
        padding: 1rem;
        transform: none !important;
    }

    .hero-card-header {
        gap: 0.75rem;
    }

    .avatar-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .chat-msg {
        font-size: 0.8rem;
        padding: 0.625rem 0.75rem;
    }

    /* Features */
    .features {
        padding: 2rem 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-card {
        padding: 1.25rem;
    }

    .feature-icon-wrap {
        width: 48px;
        height: 48px;
    }

    .feature-icon {
        font-size: 1.25rem;
    }

    /* Steps */
    .steps-progress {
        gap: 0.25rem;
        margin-bottom: 1.5rem;
    }

    .step-num {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .step span {
        font-size: 0.65rem;
    }

    .step-line {
        width: 30px;
        margin: 0 0.375rem;
        margin-bottom: 1rem;
    }

    /* Upload */
    .upload-card {
        padding: 1.25rem 1rem;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .upload-card h3 {
        font-size: 1.25rem;
    }

    .upload-zone {
        padding: 1.5rem 1rem;
    }

    .upload-zone-icon {
        font-size: 2rem;
    }

    /* Type grid */
    .type-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .type-content {
        padding: 0.75rem 0.5rem;
    }

    .type-icon { font-size: 1.25rem; }
    .type-name { font-size: 0.75rem; }
    .type-desc { font-size: 0.65rem; }

    .options-row {
        gap: 0.75rem;
    }

    .step-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .step-actions .btn {
        width: 100%;
    }

    /* Interview */
    #section-interview {
        padding: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .interview-container {
        height: auto;
        min-height: calc(100vh - 70px);
        display: flex;
        flex-direction: column;
    }

    .interview-header {
        padding: 0.625rem 0.75rem;
    }

    .int-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .int-details {
        max-width: calc(100% - 50px);
    }

    .int-name {
        font-size: 0.9rem;
    }

    .interview-header .int-role {
        font-size: 0.7rem;
    }

    .int-stats {
        gap: 1rem;
    }

    .stat-label { font-size: 0.65rem; }
    .stat-value { font-size: 0.9rem; }

    .interview-main {
        min-height: 0;
    }

    .video-panel {
        width: 100%;
        max-width: none;
        max-height: 120px;
        order: -1;
        flex-shrink: 0;
        overflow: hidden;
    }

    .video-panel video {
        max-height: 120px;
        object-fit: cover;
    }

    .video-overlay {
        min-height: 80px;
        max-height: 120px;
    }

    .chat-panel {
        min-height: 250px;
    }

    .chat-messages {
        padding: 0.75rem;
        min-height: 100px;
    }

    .message {
        max-width: 90%;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .response-area {
        padding: 0.625rem 0.75rem;
        flex-shrink: 0;
    }

    .response-controls {
        gap: 0.625rem;
    }

    .mode-tabs {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }

    .mode-btn {
        flex: 1;
    }

    .input-area { min-height: 68px; }
    .record-btn { min-height: 68px; }
    .text-mode textarea { min-height: 68px; }

    .response-buttons .btn {
        min-width: auto;
    }

    /* Audio visualizer */
    .audio-visualizer { gap: 5px; }
    .audio-bar { width: 6px; }
    .audio-bar[data-index="0"],
    .audio-bar[data-index="4"] { max-height: 22px; }
    .audio-bar[data-index="1"],
    .audio-bar[data-index="3"] { max-height: 30px; }
    .audio-bar[data-index="2"] { max-height: 38px; }

    /* Feedback */
    .feedback-container {
        padding: 0;
    }

    .score-card {
        padding: 1.25rem;
        gap: 1.5rem;
    }

    .score-circle {
        width: 90px;
        height: 90px;
    }

    .score-circle span {
        font-size: 1.5rem;
    }

    .score-label {
        font-size: 1rem;
    }

    .bar-item span:first-child {
        width: 60px;
        font-size: 0.8rem;
    }

    .feedback-card {
        padding: 1rem;
    }

    .feedback-card h3 {
        font-size: 1rem;
    }

    .question-feedback-item {
        padding: 1rem;
    }

    .question-feedback-item .question {
        font-size: 0.9rem;
    }

    .feedback-actions-row {
        flex-direction: column;
    }

    .feedback-actions-row .btn {
        width: 100%;
        max-width: none;
    }

    /* Visual metrics */
    .visual-metric .metric-value {
        font-size: 0.9rem;
    }

    /* Modals */
    .modal {
        min-width: auto;
        width: calc(100vw - 1.5rem);
    }

    .modal-lg {
        width: calc(100vw - 1rem);
        max-height: 90vh;
    }

    .modal-header { padding: 1rem; }
    .modal-body { padding: 1rem; }

    /* Cookie banner */
    .cookie-banner {
        padding: 1rem;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .cookie-actions {
        width: 100%;
        justify-content: center;
    }

    /* Footer */
    .footer { padding: 0.75rem 1rem; }
    .footer-content { gap: 0.75rem; }
    .footer-brand { font-size: 0.8rem; }
}

/* =============================================================================
   SMALL DEVICES (480px - 767px)
   ============================================================================= */
@media (min-width: 480px) and (max-width: 767px) {
    .nav {
        margin: 0.75rem auto 0;
    }

    .hero {
        gap: 2.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .type-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .int-details {
        max-width: calc(100% - 56px);
    }

    .int-stats {
        gap: 1.25rem;
    }

    .video-panel {
        width: 100%;
        max-width: 280px;
        max-height: 160px;
        margin: 0 auto;
        flex-shrink: 0;
        order: -1;
    }

    .chat-panel {
        min-height: 300px;
    }

    .chat-messages {
        min-height: 120px;
    }

    .mode-tabs {
        flex-direction: row;
        width: fit-content;
        margin: 0 auto;
    }

    .response-controls {
        gap: 0.75rem;
    }

    .score-card {
        text-align: center;
    }

    .match-details {
        grid-template-columns: 1fr;
    }

    .modal-lg {
        width: 95vw;
    }

    .options-row {
        gap: 1rem;
    }
}

/* =============================================================================
   MEDIUM DEVICES (768px - 1023px)
   ============================================================================= */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }

    .hero-content { order: 1; }
    .hero-visual { order: 2; }

    .hero-subtitle {
        max-width: 100%;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-card {
        transform: none;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .int-details {
        max-width: 280px;
    }

    .interview-main {
        flex-direction: row;
    }

    .video-panel {
        width: 200px;
    }

    .chat-panel {
        min-height: 400px;
    }

    .score-card {
        gap: 2rem;
    }
}

/* =============================================================================
   LARGE DEVICES (1024px - 1279px)
   ============================================================================= */
@media (min-width: 1024px) and (max-width: 1279px) {
    .hero { gap: 3rem; }
    .hero-title { font-size: 2.75rem; }
    .video-panel { width: 200px; }
}

/* =============================================================================
   EXTRA LARGE DEVICES (≥ 1280px)
   ============================================================================= */
@media (min-width: 1280px) {
    .hero-title { font-size: 3.5rem; }
    .interview-container { max-width: 1600px; }
    .video-panel { width: 280px; }
}

/* =============================================================================
   HEIGHT-BASED ADJUSTMENTS
   ============================================================================= */
@media (max-height: 600px) {
    .hero {
        min-height: auto;
        padding: 1.5rem 0;
    }

    .interview-container {
        height: calc(100vh - 80px);
    }

    .chat-messages {
        min-height: 150px;
    }
}

@media (max-width: 767px) and (max-height: 500px) {
    .interview-main { flex-direction: row; }
    .video-panel { width: 150px; order: 0; }
    .chat-panel { min-height: 200px; }
}

/* =============================================================================
   LANDSCAPE ORIENTATION (Phones)
   ============================================================================= */
@media (max-width: 900px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 1rem 0;
    }

    .interview-container { height: calc(100vh - 70px); }
    .interview-header { padding: 0.5rem 0.75rem; }
    .interview-main { flex-direction: row; }
    .video-panel { width: 180px; }
    .chat-panel { min-height: 250px; }
    .chat-messages { padding: 0.5rem; }
    .response-area { padding: 0.5rem 0.75rem; }
}

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* =============================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================================= */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .glass-card:hover,
    .feature-card:hover .feature-icon-wrap,
    .upload-zone:hover {
        transform: none;
    }

    .btn,
    .nav-btn,
    .mode-btn,
    .tab {
        min-height: 44px;
        min-width: 44px;
    }
}