/* Mobile Responsive CSS for Sex Education Website */

/* Base Mobile Styles */
@media (max-width: 768px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    body {
        padding: 10px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    .container {
        padding: 20px 15px;
        margin: 0;
        border-radius: 8px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
        text-align: center;
    }
    
    h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    /* Global header/nav adjustments */
    .header .nav-container,
    .nav-container {
        padding: 0 12px !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .nav-menu {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px 10px !important;
    }

    .nav-menu a:not(:last-child)::after {
        display: none !important;
    }

    .logo {
        margin-left: 0 !important;
        font-size: 1.3rem !important;
    }

    /* Hero section adjustments */
    .hero-title { font-size: 2rem !important; }
    .hero-subtitle { font-size: 1rem !important; }
    .cta-button { width: 100% !important; max-width: 420px; }

    /* Common container padding */
    .container { padding: 0 12px !important; }

    /* Tables */
    table {
        width: 100%;
        font-size: 0.9rem;
        border-collapse: collapse;
        margin: 15px 0;
    }
    img, video { max-width: 100%; height: auto; }
    iframe { max-width: 100%; }

    th, td {
        padding: 8px;
        border: 1px solid #ddd;
        text-align: left;
        word-break: break-word;
    }
    
    th {
        background-color: #f2f2f2;
        font-weight: 600;
    }
    
    /* Cards and Boxes */
    .card, .info-box, .step, .status {
        padding: 15px;
        margin: 15px 0;
        border-radius: 8px;
        background: #f8f9fa;
        border-left: 4px solid #3498db;
    }
    
    /* Grid fixes across pages */
    .platform-grid,
    .quick-grid,
    .health-grid,
    .contraception-grid,
    .faq-categories {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
    
    /* Avoid overly large cards on small screens */
    .quick-card { min-height: unset !important; }

    /* Top bar and dropdown (prevent overlap on mobile) */
    .top-bar { flex-wrap: wrap; gap: 8px; }
    .top-bar-left, .top-bar-right { width: 100%; }
    .top-bar-right { justify-content: flex-end; display: flex; }

    .user-dropdown { position: static !important; }
    .user-dropdown-content {
        position: fixed !important;
        left: 12px;
        right: 12px;
        top: 64px;
        width: auto !important;
        max-width: none !important;
        z-index: 2000;
    }

    /* Messages */
    .success, .error, .warning {
        padding: 12px;
        font-size: 0.9rem;
        line-height: 1.4;
        border-radius: 5px;
        margin: 15px 0;
    }
    
    .success {
        background: #d4edda;
        border: 1px solid #c3e6cb;
        color: #155724;
    }
    
    .error {
        background: #f8d7da;
        border: 1px solid #f5c6cb;
        color: #721c24;
    }
    
    .warning {
        background: #fff3cd;
        border: 1px solid #ffeaa7;
        color: #856404;
    }
    
    /* Lists */
    ul, ol {
        padding-left: 20px;
    }
    
    li {
        margin-bottom: 5px;
    }
    
    /* Links in messages */
    .success a, .error a, .warning a {
        display: block;
        margin: 8px 0;
        padding: 8px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        text-align: center;
        text-decoration: none;
        color: inherit;
        font-weight: 500;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    .btn {
        width: 100%;
        margin: 5px 0;
        padding: 14px;
        font-size: 1rem;
    }
    
    .logo { font-size: 1.15rem !important; }
    .hero-title { font-size: 1.6rem !important; }
    .hero-subtitle { font-size: 0.95rem !important; }
    .cta-button { padding: 0.9rem 1.2rem !important; font-size: 1.05rem !important; }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    .card, .info-box, .step, .status {
        padding: 12px;
        margin: 12px 0;
    }
    
    .success, .error, .warning {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Touch-friendly elements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
    }
    
    .input-group input {
        min-height: 48px;
    }
    
    a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding: 10px 15px;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .card, .info-box, .step, .status {
        padding: 12px;
        margin: 10px 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .input-group input {
        border-width: 0.5px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .card, .info-box, .step, .status {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .input-group input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    table {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    th {
        background-color: #4a5568;
    }
    
    th, td {
        border-color: #718096;
    }
}
