/* ============================================
   COMPREHENSIVE RESPONSIVE DESIGN
   Mobile-first approach with full device support
   ============================================ */

/* Base Mobile Styles (320px+) */
@media (max-width: 767px) {
    /* Container & Layout */
    .novel-container {
        padding: 15px;
        max-width: 100%;
    }
    
    /* Navigation */
    .nav-bar {
        padding: 12px 15px;
        flex-wrap: wrap;
    }
    
    .brand-logo {
        font-size: 1.4rem;
    }
    
    .nav-links {
        width: 100%;
        margin-top: 10px;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-links a {
        margin-left: 0;
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    /* Cards */
    .card {
        padding: 20px 15px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    /* Typography */
    h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.2rem !important;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
        width: auto;
        min-width: 100px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    /* Forms */
    input[type="text"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    textarea {
        min-height: 120px;
    }
    
    /* Grid Layouts */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Work/Chapter Lists */
    .work-card,
    .chapter-item {
        margin-bottom: 15px;
    }
    
    /* Comment Section */
    .comment-item {
        padding: 12px;
    }
    
    .comment-avatar {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Author Profile */
    .author-stats {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    /* Novel Viewer (Reading) */
    .novel-viewer {
        font-size: 1.1rem !important;
        line-height: 2.2 !important;
        padding: 15px !important;
    }
    
    /* Editor */
    .editor-wrapper {
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    .editor-main,
    .editor-preview {
        width: 100% !important;
        flex: none !important;
    }
    
    .editor-preview {
        border-left: none !important;
        border-top: 1px solid #eee;
        max-height: 300px;
        min-height: 200px;
    }
    
    .editor-toolbar {
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px;
    }
    
    .toolbar-group {
        margin-bottom: 5px;
    }
    
    .toolbar-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    textarea.editor-content {
        min-height: 300px !important;
        font-size: 1rem !important;
    }
    
    /* Flexbox Adjustments */
    div[style*="display: flex"] {
        flex-wrap: wrap;
    }
    
    /* Hide less important elements on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Touch-friendly spacing */
    a, button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Follow Stats */
    div[style*="gap: 30px"] {
        gap: 15px !important;
    }
}

/* Tablet Styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .novel-container {
        padding: 20px;
        max-width: 100%;
    }
    
    .nav-bar {
        padding: 15px 20px;
    }
    
    .card {
        padding: 25px;
    }
    
    /* Grid: 2 columns on tablet */
    div[style*="grid-template-columns: repeat(auto-fill"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .editor-wrapper {
        height: 60vh;
    }
    
    .novel-viewer {
        font-size: 1.15rem;
        line-height: 2.5;
    }
}

/* Desktop Optimization (1024px+) */
@media (min-width: 1024px) {
    .novel-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 30px;
    }
    
    /* Hover effects only on desktop */
    .hover-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    .novel-container {
        max-width: 1400px;
    }
    
    .novel-viewer {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* Landscape Mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .editor-wrapper {
        flex-direction: row !important;
    }
    
    .editor-preview {
        border-left: 1px solid #eee !important;
        border-top: none !important;
        max-height: none;
    }
}

/* Print Styles */
@media print {
    .nav-bar,
    .btn,
    .editor-toolbar,
    .comment-form,
    footer {
        display: none !important;
    }
    
    .novel-viewer {
        font-size: 12pt;
        line-height: 1.8;
        color: #000;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .brand-logo,
    h1, h2, h3 {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (if user prefers) */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles here if needed */
}
