/* Laughter Detector - Mobile-First Responsive CSS */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0; /* remove outer padding to eliminate top spacing */
    min-height: 100vh;
}

/* Header Styles */
.app-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Section Styles */
.section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.hidden {
    display: none !important;
}

/* Authentication Styles */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

/* Setup Container - Scrollable content area */
.setup-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    text-align: center;
    padding: 20px;
    padding-bottom: 60px; /* Space for bottom nav */
}

.setup-container h2 {
    margin-bottom: 15px;
    color: #333;
}

.setup-container p {
    margin-bottom: 25px;
    color: #666;
    font-size: 1.1rem;
}

/* Summary Container */
.summary-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8rem;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.day-card {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255, 154, 158, 0.3);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.day-card:hover {
    transform: translateY(-5px);
}

.day-card h3 {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.day-card p {
    font-size: 1.1rem;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.day-card .date {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Management Buttons */
.management-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    position: sticky; /* keep visible while scrolling the list */
    bottom: 80px; /* sit just above the fixed bottom nav */
    z-index: 90;
}

/* Settings Screen - Scrollable content area */
.settings-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: 60px; /* Space for bottom nav */
    max-width: 400px;
    margin: 0 auto;
}

.settings-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #374151;
    font-size: 1.5rem;
    font-weight: 600;
}

.settings-section {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    margin-bottom: 15px;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 500;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
}

.settings-section .btn {
    width: 100%;
    margin-bottom: 10px;
}

.settings-section .btn:last-child {
    margin-bottom: 0;
}

.settings-help-text {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.reprocess-form {
    margin-top: 15px;
}

.reprocess-form .input-group {
    margin-bottom: 15px;
}

.reprocess-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    background: #f8f9fa;
}

.reprocess-status.hidden {
    display: none;
}

.reprocess-status .status-message {
    color: #0066cc;
    margin: 0;
}

.reprocess-status .status-success {
    color: #28a745;
    margin: 0;
}

.reprocess-status .status-error {
    color: #dc3545;
    margin: 0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f3f4f6;
}

.management-buttons .btn {
    flex: 1;
    min-width: 150px;
}

/* Detail View - Scrollable content area */
#day-detail {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: white;
    border-radius: 0; /* Remove border-radius for full-width */
    padding: 20px;
    padding-bottom: 60px; /* Space for bottom nav */
    margin: 0; /* Override .section margin */
    box-shadow: none; /* Remove box-shadow for cleaner look */
    backdrop-filter: none; /* Remove backdrop-filter */
    border: none; /* Remove border */
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Stack children vertically */
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-header h2 {
    flex: 1;
    color: #333;
    font-size: 1.8rem;
}

.detail-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-controls label {
    font-weight: 600;
    color: #555;
}

.filter-controls input[type="range"] {
    flex: 1;
    min-width: 200px;
}

.filter-controls span {
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding-bottom: 100px; /* Space for bottom nav */
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

.audio-clip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.audio-clip audio {
    max-width: 200px;
}

.notes-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    font-size: 14px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-message {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.toast {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-left: 4px solid #667eea;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .section {
        padding: 20px;
    }
    
    .cards-container {
        grid-template-columns: 1fr;
    }
    
    .day-card {
        padding: 20px;
    }
    
    .day-card h3 {
        font-size: 2.5rem;
    }
    
    .management-buttons {
        flex-direction: column;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-controls input[type="range"] {
        width: 100%;
    }
    
    .table-container {
        font-size: 14px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .audio-clip audio {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .section {
        padding: 15px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .day-card h3 {
        font-size: 2rem;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        color: #fff;
    }
    
    .day-card {
        background: #000;
        color: #fff;
    }
    
    .section {
        border: 2px solid #000;
    }
}

/* Print styles */
@media print {
    .app-header {
        color: #000;
        background: none;
    }
    
    .section {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn {
        display: none;
    }
    
    .loading-overlay {
        display: none;
    }
    
    .toast-container {
        display: none;
    }
}

/* ========================================
   MOBILE APP REDESIGN STYLES
   ======================================== */

/* Color Palette Variables */
:root {
    --color-black: #000000;
    --color-orange: #FF6B35;
    --color-blue: #1E3A8A;
    --color-white: #F8F9FA;
    --color-yellow: #FFD700;
    --color-pink: #FFB6C1;
    --text-dark: #000000;
    --text-light: #FFFFFF;
}

/* Mobile App Container - Fixed viewport, prevents scrolling between screens */
.mobile-app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    z-index: 1;
}

/* Mobile Header */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    z-index: 100;
}

.header-left, .header-right {
    width: 40px;
    display: flex;
    justify-content: center;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.icon-btn {
    min-width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    padding: 0 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #374151;
}

.icon-btn:hover {
    background: #f3f4f6;
}

/* Day Cards Container */
.day-cards-container {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 100px; /* Space for sticky management buttons + bottom nav */
}

/* Day Card Styles */
.day-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.day-card.clickable {
    cursor: pointer;
}

/* Card Color Classes */
.day-card.color-0 { background: var(--color-black); }
.day-card.color-1 { background: var(--color-orange); }
.day-card.color-2 { background: var(--color-blue); }
.day-card.color-3 { background: var(--color-white); }
.day-card.color-4 { background: var(--color-yellow); }
.day-card.color-5 { background: var(--color-pink); }

/* Text color based on background */
.day-card.color-0 .card-text,
.day-card.color-2 .card-text {
    color: var(--text-light);
}

.day-card.color-1 .card-text,
.day-card.color-3 .card-text,
.day-card.color-4 .card-text,
.day-card.color-5 .card-text {
    color: var(--text-dark);
}

/* Card Content Layout */
.card-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-info {
    flex: 1;
}

.card-day {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-date {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-count {
    font-size: 96px;
    font-weight: 900;
    margin-bottom: 4px;
    line-height: 0.9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-label {
    font-size: 14px;
    font-weight: 400;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-play {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-top: 8px;
}

.day-card.color-0 .card-play,
.day-card.color-2 .card-play {
    background: rgba(255, 255, 255, 0.2);
}

/* Bottom Navigation - Fixed at bottom of viewport */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
    flex: 1;
    max-width: 120px;
}

.nav-item:hover {
    background: #f3f4f6;
}

.nav-item.active {
    background: #f3f4f6;
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
    line-height: 1;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    line-height: 1.2;
}

.nav-item.active .nav-label {
    color: #1f2937;
    font-weight: 600;
}

/* Mobile Summary Container - Scrollable content area */
.mobile-summary {
    background: transparent;
    padding: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 60px; /* Space for bottom nav */
}

.mobile-summary .management-buttons {
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .day-cards-container {
        padding: 0 16px; /* remove top padding on mobile too */
    }
    
    .day-card {
        padding: 16px;
    }
    
    .card-count {
        font-size: 80px;
        font-weight: 900;
        line-height: 0.9;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    
    .mobile-header {
        padding: 12px 16px;
    }
    
    .app-title {
        font-size: 16px;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
}
