/* assets/css/responsive.css - Mobile und Responsive Styles */

/* Tablet und kleiner (768px) */
@media (max-width: 768px) {
    /* Platz für Bottom Tab Bar */
    body {
        padding-bottom: 64px;
    }

    /* FAB über Tab Bar positionieren */
    .fab {
        bottom: 80px !important;
    }

    .fab-menu {
        bottom: 140px !important;
    }

    /* Container */
    .container {
        padding: var(--spacing-md);
    }
    
    /* Header */
    header {
        padding: var(--spacing-md);
    }
    
    .logo {
        height: 40px;
    }
    
    .header-nav {
        gap: var(--spacing-sm);
    }

    .legal-close {
        top: 73px;
    }

    .icon-button {
        padding: var(--spacing-sm);
    }
    
    /* Greeting */
    .greeting,
    .dashboard-greeting h1 {
        font-size: var(--text-2xl);
    }
    
    .date-info {
        font-size: var(--text-base);
    }
    
    /* Quick Stats - Horizontal Scroll */
    .quick-stats {
        display: flex;
        gap: 15px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin-left: -var(--spacing-md);
        margin-right: -var(--spacing-md);
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
    
    .stat-card {
        flex: 0 0 160px;
        scroll-snap-align: start;
        padding: 20px;
        min-height: auto;
    }
    
    .stat-header {
        margin-bottom: 10px;
    }
    
    .stat-icon {
        width: 20px !important;
        height: 20px !important;
    }
    
    .stat-value {
        font-size: var(--text-3xl);
    }
    
    .stat-title {
        font-size: var(--text-sm);
    }
    
    .stat-subtitle {
        font-size: var(--text-xs);
    }
    
    /* Scrollbar für Quick Stats */
    .quick-stats::-webkit-scrollbar {
        height: 4px;
    }
    
    .quick-stats::-webkit-scrollbar-track {
        background: var(--navy-100);
        border-radius: 2px;
    }
    
    .quick-stats::-webkit-scrollbar-thumb {
        background: var(--navy-400);
        border-radius: 2px;
    }
    
    /* Entry Grid */
    .entry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .entry-card {
        min-height: auto;
        padding: 20px;
    }

    /* Wizard steps in bottom sheet */
    .wizard-btn {
        padding: 8px 14px;
        font-size: var(--text-sm);
    }

    .wizard-emoji-item .wizard-emoji {
        font-size: var(--text-2xl);
    }

    .wizard-emoji-item {
        min-width: 48px;
        min-height: 48px;
        padding: 8px;
    }

    /* Entry Grid single column on tablet */
    .entry-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mood Scale */
    .mood-scale {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .mood-scale-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .mood-scale-4 .mood-item {
        height: 75px;
        padding: 12px 8px;
    }
    
    .mood-scale-4 .mood-item i {
        width: 28px !important;
        height: 28px !important;
    }
    
    /* Feeling Grid */
    .feeling-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .feeling-item {
        padding: 6px;
        min-height: 50px;
    }
    
    .feeling-item span {
        font-size: var(--text-xs);
    }
    
    /* Forms */
    .form-label {
        font-size: var(--text-sm);
    }
    
    .form-input {
        padding: 10px 16px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    /* Recent Entries */
    .recent-entries {
        padding: 20px;
    }
    
    .entry-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .entry-time {
        align-self: flex-start;
        font-size: var(--text-xs);
    }
    
    /* Dropdown Menus */
    .dropdown-menu {
        left: var(--spacing-md) !important;
        right: var(--spacing-md) !important;
        width: auto !important;
    }
}

/* Small mobile - single column entry grid */
@media (max-width: 480px) {
    .entry-grid {
        grid-template-columns: 1fr;
    }

    .wizard-emoji-item .wizard-emoji {
        font-size: var(--text-xl);
    }

    .wizard-emoji-item .wizard-emoji-label {
        font-size: var(--text-xs);
    }

    .wizard-time-pair {
        gap: 8px;
    }

    .entry-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile (600px und kleiner) */
@media (max-width: 600px) {
    /* Noch kompaktere Stats */
    .stat-card {
        flex: 0 0 140px;
        padding: 15px;
    }
    
    .stat-value {
        font-size: var(--text-3xl);
    }
    
    /* Time Inputs nebeneinander */
    .time-inputs {
        gap: 10px;
    }
    
    /* Feeling Grid noch kleiner */
    .feeling-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    
    .feeling-item {
        padding: 4px;
        min-height: 45px;
    }
    
    .feeling-item i {
        width: 16px !important;
        height: 16px !important;
    }
    
    .feeling-item span {
        font-size: var(--text-xs);
    }
    
    /* Section Title */
    .section-title {
        font-size: var(--text-xl);
        gap: var(--spacing-xs);
    }
    
    .section-title i {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* Entry Header */
    .entry-header {
        gap: 10px;
    }
    
    .entry-icon {
        width: 40px;
        height: 40px;
    }
    
    .entry-icon i {
        width: 24px !important;
        height: 24px !important;
    }
    
    .entry-title h3 {
        font-size: var(--text-lg);
    }
    
    .entry-title p {
        font-size: var(--text-sm);
    }
    
    /* Buttons */
    .button {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    /* Toast */
    .toast {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
        min-width: auto;
        font-size: var(--text-base);
    }
}

/* Sehr kleine Bildschirme (400px und kleiner) */
@media (max-width: 400px) {
    /* Header noch kompakter */
    .header-content {
        gap: var(--spacing-sm);
    }
    
    .logo {
        height: 35px;
    }
    
    /* Stat Cards noch kleiner */
    .stat-card {
        flex: 0 0 120px;
    }
    
    /* Mood Scale 2x2 Grid für 4 Items */
    .mood-scale-4 .mood-item {
        height: 70px;
        padding: 10px 6px;
    }
    
    /* Feeling Grid 2 Spalten */
    .feeling-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Landscape Mode für Mobile */
@media (max-height: 600px) and (orientation: landscape) {
    /* Header kleiner */
    header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .logo {
        height: 35px;
    }

    .legal-close {
        top: 52px;
    }
    
    /* Entry Cards nebeneinander wenn möglich */
    @media (min-width: 800px) {
        .entry-grid {
            grid-template-columns: repeat(3, 1fr);
        }
        
        .entry-card {
            min-height: 400px;
        }
    }
}

/* Auto Dark Mode: Nur wenn User kein Theme manuell gewählt hat */
@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        color-scheme: dark;
    }
    html:not([data-theme]) body {
        --bg-primary: #0f172a;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border: #334155;
        --surface: #1e293b;
        --surface-elevated: #1e293b;
    }
}

/* Reduce Motion für Barrierefreiheit */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .quality-slider::-webkit-slider-thumb {
        transition: none;
    }
    
    .mood-item,
    .feeling-item,
    .button,
    .stat-card,
    .wizard-btn,
    .wizard-emoji-item,
    .wizard-tag,
    .wizard-step {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    header,
    .quick-entry-section,
    .button,
    .icon-button {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .stat-card,
    .recent-entries {
        break-inside: avoid;
    }
}