/* =============================================================
   GOLDIE CHAT - MOBILE RESPONSIVE (Claude-Style Interface)
   Mirrors Claude AI web interface for mobile screens
   Desktop: Modern warm design
   Mobile: Clean, modern chat interface
   ============================================================= */

/* =============================================================
   MOBILE BREAKPOINT - Claude-Style Interface
   ============================================================= */
@media (max-width: 768px) {
    /* Reset body for mobile */
    body.gc-fullscreen-chat {
        background: #FAF9F7;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }

    /* Full-screen chat page container */
    .gc-chat-page {
        padding: 0;
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile */
        align-items: stretch;
    }

    /* Hide TV decorations on mobile */
    .tv-container {
        background: transparent;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        max-width: 100%;
    }

    .tv-container::before,
    .tv-container::after,
    .screw-bottom-left,
    .screw-bottom-right,
    .speaker-grill {
        display: none !important;
    }

    /* Main layout - full width, no sidebar */
    .main-layout {
        flex-direction: column;
        gap: 0;
        height: 100vh;
        height: 100dvh;
    }

    /* Hide sidebar completely on mobile */
    .gc-ad-sidebar {
        display: none !important;
    }

    /* Screen section - full screen */
    .screen-section {
        background: #FAF9F7;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    /* =============================================================
       MOBILE HEADER - Minimal Claude-Style
       ============================================================= */
    .gc-chat-top-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #FFFFFF;
        border-bottom: 1px solid #E5E5E5;
        padding: 12px 16px;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 60px;
    }

    /* Left section - Back button and avatar */
    .gc-left-section {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        margin-left: 0;
    }

    .gc-logo-corner-img {
        height: 44px;
        width: 44px;
        border: 2px solid #F5A623;
        margin-top: 0;
        box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
    }

    .gc-back-button {
        background: transparent;
        color: #666;
        border: none;
        padding: 8px 12px;
        font-size: 14px;
        box-shadow: none;
        font-family: inherit;
    }

    .gc-back-button:hover,
    .gc-back-button:active {
        background: #F0F0F0;
        transform: none;
        box-shadow: none;
    }

    /* Hide title section on mobile */
    .gc-title-section {
        display: none !important;
    }

    /* Hide profile section on mobile header (too cramped) */
    .gc-profile-section {
        display: none !important;
    }

    /* Top right - simplified controls */
    .gc-chat-top-right {
        gap: 8px;
        flex-wrap: nowrap;
    }

    /* Hide controls panel on mobile */
    .gc-controls-panel {
        display: none !important;
    }

    /* Hide dropdown menu on mobile */
    .gc-dropdown-menu {
        display: none !important;
    }

    /* Button stack - minimal */
    .button-stack {
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }

    /* Hide premium badge on mobile (save space) */
    .premium-badge {
        display: none;
    }

    /* Token badge - compact */
    .gc-token-badge {
        padding: 6px 12px;
        font-size: 11px;
        border-radius: 16px;
        min-width: auto;
    }

    /* New chat button - smaller */
    .gc-new-chat-btn {
        width: 36px;
        height: 36px;
        font-size: 10px;
        border-width: 2px;
    }

    .gc-new-chat-btn::before,
    .gc-new-chat-btn::after {
        display: none;
    }

    /* Accessibility button - smaller */
    .gc-accessibility-trigger-chat {
        width: 36px;
        height: 36px;
    }

    .gc-accessibility-trigger-chat svg {
        width: 36px;
        height: 36px;
    }

    /* =============================================================
       MOBILE CHAT MESSAGES - Claude-Style
       ============================================================= */
    .gc-chat-messages {
        flex: 1;
        background: #FAF9F7;
        border: none;
        border-radius: 0;
        height: auto;
        padding: 16px;
        padding-bottom: 100px; /* Space for fixed input */
        overflow-y: auto;
        box-shadow: none;
        -webkit-overflow-scrolling: touch;
    }

    /* Messages container */
    .gc-message {
        margin-bottom: 20px;
        gap: 10px;
        max-width: 100%;
    }

    /* Goldie (AI) messages - Claude style */
    .gc-message:not(.gc-user-message) {
        flex-direction: row;
        align-items: flex-start;
    }

    .gc-message-avatar {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

    .gc-message-avatar img {
        border-radius: 50%;
    }

    .gc-message-bubble {
        background: #FFFFFF;
        border: none;
        border-left: none;
        border-radius: 18px;
        padding: 12px 16px;
        font-size: 18px;
        line-height: 1.5;
        max-width: calc(100% - 50px);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        color: #1A1A1A;
    }

    /* User messages - right aligned, darker background */
    .gc-user-message {
        flex-direction: row-reverse;
        justify-content: flex-start;
    }

    .gc-user-message .gc-message-bubble {
        background: #F5A623;
        color: #1A1A1A;
        border-right: none;
        border-radius: 18px;
        max-width: 85%;
    }

    /* Hide user avatar (Claude style) */
    .gc-user-message .gc-message-avatar {
        display: none;
    }

    /* Typing indicator */
    .gc-typing-indicator {
        padding: 0 16px;
    }

    .gc-typing-dots {
        background: #FFFFFF;
        border: none;
        border-left: none;
        border-radius: 18px;
        padding: 12px 16px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .gc-typing-dots span {
        background: #999;
    }

    /* =============================================================
       MOBILE INPUT AREA - Fixed Bottom (Claude-Style)
       ============================================================= */
    .gc-chat-input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #FFFFFF;
        border-top: 1px solid #E5E5E5;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        margin-top: 0;
        z-index: 100;
    }

    .gc-input-wrapper {
        display: flex;
        gap: 8px;
        align-items: flex-end;
        max-width: 100%;
    }

    .gc-chat-input {
        flex: 1;
        background: #F5F5F5;
        border: 2px solid #E0E0E0;
        border-radius: 20px;
        padding: 16px 20px;
        font-size: 20px;  /* BIGGER text for elderly */
        font-family: inherit;
        color: #1A1A1A;
        min-height: 70px;  /* Taller input */
        max-height: 150px;
        resize: none;
        box-shadow: none;
        line-height: 1.4;
    }

    .gc-chat-input:focus {
        border-color: #F5A623;
        outline: none;
        box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.25);
    }

    .gc-chat-input::placeholder {
        color: #666;
        font-size: 20px;  /* BIGGER placeholder for elderly */
    }

    /* Send button - circular gold */
    .gc-send-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        background: linear-gradient(135deg, #F5A623, #E8960C);
        border: none;
        border-radius: 50%;
        padding: 0;
        font-size: 18px;
        box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .gc-send-button:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(245, 166, 35, 0.4);
    }

    /* Voice button - smaller, circular */
    .gc-voice-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        background: #10B981;
        border: none;
        border-radius: 50%;
        padding: 0;
        font-size: 18px;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .gc-voice-button:hover {
        transform: scale(1.05);
    }

    .gc-voice-disabled {
        background: #E0E0E0;
        opacity: 1;
        box-shadow: none;
    }

    /* Hide bottom ad space on mobile */
    .bottom-ad-space {
        display: none !important;
    }

    /* =============================================================
       MOBILE QUESTION OPTIONS - Full Width Buttons
       ============================================================= */
    .gc-question-options {
        padding: 8px 0;
        gap: 8px;
    }

    .gc-option-button {
        background: #FFFFFF;
        border: 2px solid #E0E0E0;
        border-radius: 12px;
        padding: 14px 16px;
        font-size: 15px;
        font-family: inherit;
        color: #1A1A1A;
        text-align: left;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        transition: all 0.2s ease;
    }

    .gc-option-button:hover {
        border-color: #F5A623;
        background: #FFF9F0;
        transform: none;
        box-shadow: 0 2px 6px rgba(245, 166, 35, 0.15);
        color: #1A1A1A;
    }

    .gc-option-button:active {
        background: #F5A623;
        color: #FFFFFF;
        transform: scale(0.98);
    }

    .gc-option-button.selected {
        background: #F5A623;
        border-color: #E8960C;
        color: #FFFFFF;
    }

    .gc-continue-button {
        background: linear-gradient(135deg, #F5A623, #E8960C);
        border: none;
        border-radius: 12px;
        padding: 14px 24px;
        font-size: 16px;
        font-family: inherit;
        color: #FFFFFF;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
    }

    .gc-continue-button:hover:not(:disabled) {
        transform: none;
        box-shadow: 0 4px 12px rgba(245, 166, 35, 0.4);
    }

    .gc-continue-button:disabled {
        background: #E0E0E0;
        box-shadow: none;
    }

    /* Progress indicator */
    .gc-progress-indicator {
        font-size: 13px;
        padding: 8px 12px;
        background: #FFF9F0;
        border: 1px solid #FFE5B4;
        border-radius: 8px;
        margin: 8px 0;
    }

    /* =============================================================
       MOBILE TEXT SIZE ADJUSTMENTS
       ============================================================= */
    body.gc-text-normal .gc-message-bubble {
        font-size: 18px;
    }

    body.gc-text-medium .gc-message-bubble {
        font-size: 21px;
    }

    body.gc-text-large .gc-message-bubble {
        font-size: 24px;
    }

    body.gc-text-xlarge .gc-message-bubble {
        font-size: 28px;
    }

    /* =============================================================
       MOBILE SCROLLBAR - Minimal
       ============================================================= */
    .gc-chat-messages::-webkit-scrollbar {
        width: 4px;
    }

    .gc-chat-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .gc-chat-messages::-webkit-scrollbar-thumb {
        background: #D0D0D0;
        border-radius: 4px;
    }
}

/* =============================================================
   EXTRA SMALL MOBILE (iPhone SE, etc.)
   ============================================================= */
@media (max-width: 375px) {
    .gc-chat-top-bar {
        padding: 10px 12px;
    }

    .gc-logo-corner-img {
        height: 36px;
        width: 36px;
    }

    .gc-back-button {
        padding: 6px 8px;
        font-size: 13px;
    }

    .gc-token-badge {
        font-size: 12px;
        padding: 6px 10px;
    }

    .gc-new-chat-btn,
    .gc-accessibility-trigger-chat {
        width: 36px;
        height: 36px;
    }

    .gc-chat-messages {
        padding: 12px;
    }

    .gc-message-bubble {
        font-size: 15px;
        padding: 10px 14px;
    }

    .gc-option-button {
        padding: 12px 14px;
        font-size: 14px;
    }

    .gc-chat-input-area {
        padding: 10px 12px;
    }

    .gc-chat-input {
        padding: 14px 16px;
        font-size: 18px;  /* Still big for elderly on small screens */
        min-height: 60px;
    }

    .gc-chat-input::placeholder {
        font-size: 18px;
    }

    .gc-send-button,
    .gc-voice-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}

/* =============================================================
   LANDSCAPE MOBILE - Adjust heights
   ============================================================= */
@media (max-width: 768px) and (orientation: landscape) {
    .gc-chat-messages {
        padding-bottom: 100px;
    }

    .gc-chat-input-area {
        padding: 10px 16px;
    }

    .gc-chat-input {
        min-height: 50px;
        padding: 12px 16px;
        font-size: 18px;  /* Big text even in landscape */
    }

    .gc-chat-input::placeholder {
        font-size: 18px;
    }

    .gc-send-button,
    .gc-voice-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}

/* =============================================================
   MOBILE MENU OVERLAY (For future hamburger menu)
   ============================================================= */
@media (max-width: 768px) {
    .gc-mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .gc-mobile-menu-overlay.active {
        display: block;
    }

    .gc-mobile-menu {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100%;
        background: #FFFFFF;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        transition: right 0.3s ease;
        padding: 60px 20px 20px;
    }

    .gc-mobile-menu.active {
        right: 0;
    }

    .gc-mobile-menu-close {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
        background: #F5F5F5;
        border: none;
        border-radius: 50%;
        font-size: 20px;
        cursor: pointer;
    }

    .gc-mobile-menu a {
        display: block;
        padding: 15px 0;
        color: #1A1A1A;
        text-decoration: none;
        font-size: 16px;
        border-bottom: 1px solid #E5E5E5;
    }

    .gc-mobile-menu a:hover {
        color: #F5A623;
    }
}

/* =============================================================
   ACCESSIBILITY - High contrast mode support
   ============================================================= */
@media (prefers-contrast: high) and (max-width: 768px) {
    .gc-message-bubble {
        border: 2px solid #000;
    }

    .gc-user-message .gc-message-bubble {
        border: 2px solid #000;
    }

    .gc-option-button {
        border-width: 2px;
    }

    .gc-chat-input {
        border-width: 2px;
    }
}

/* =============================================================
   DARK MODE SUPPORT (Future enhancement)
   ============================================================= */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    /* Keep light mode for now - seniors prefer high contrast */
    /* Can be enabled later with a toggle */
}
