/* Baby Project Tracker - Styles */

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --secondary: #81C784;
    --success: #2ECC71;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;
    --light: #F8F9FA;
    --dark: #2C3E50;
    --gray: #95A5A6;
    --baby-pink: #F3E5F5;
    --baby-blue: #E3F2FD;
    --baby-yellow: #FFF9E6;
    --baby-green: #E8F5E9;
    --baby-purple: #EDE7F6;
    --shadow: 0 2px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 5px 30px rgba(0,0,0,0.15);
    --radius: 16px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--baby-green) 0%, var(--baby-blue) 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--dark);
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    margin: 0 0 1rem 0;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-fun {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 5px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-fun:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Header */
.header {
    background: white;
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    color: var(--dark);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-links a:hover {
    background: var(--light);
}

.nav-links a.active {
    background: var(--baby-green);
    color: var(--primary);
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #E8E8E8;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #27AE60 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #C0392B 100%);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* Prompt Cards (Student View) */
.prompt-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prompt-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.prompt-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.prompt-info {
    flex: 1;
}

.prompt-type {
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.prompt-message {
    color: var(--gray);
    font-size: 0.9rem;
}

.prompt-timer {
    text-align: right;
}

.timer-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
}

.timer-urgent .timer-value {
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.prompt-body {
    padding: 0 1.25rem 1.25rem;
}

.prompt-actions {
    display: flex;
    gap: 0.75rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.stats-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

/* Response Card */
.response-card {
    background: var(--light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.response-photo {
    width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--baby-green);
    color: #27AE60;
}

.badge-warning {
    background: var(--baby-yellow);
    color: #D68910;
}

.badge-danger {
    background: #FFEBEE;
    color: var(--danger);
}

.badge-info {
    background: var(--baby-blue);
    color: var(--info);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray);
}

.empty-state .btn {
    margin-top: 1rem;
}

/* Alert/Flash Messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--baby-green);
    color: #1B5E20;
}

.alert-error {
    background: #FFEBEE;
    color: #B71C1C;
}

.alert-info {
    background: var(--baby-blue);
    color: #0D47A1;
}

/* Tables (Teacher View) */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #E0E0E0;
}

.table th {
    background: var(--light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--gray);
}

.table tr:hover {
    background: var(--light);
}

/* Photo Upload */
.photo-upload {
    border: 3px dashed #E0E0E0;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.photo-upload:hover {
    border-color: var(--primary);
    background: var(--baby-green);
}

.photo-upload i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.photo-upload.has-photo {
    padding: 0;
    border-style: solid;
    border-color: var(--success);
}

.photo-upload.has-photo img {
    width: 100%;
    display: block;
    border-radius: var(--radius);
}

.photo-upload input[type="file"] {
    display: none;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 4rem;
    color: var(--primary);
}

.login-logo h1 {
    color: var(--primary);
    margin-top: 0.5rem;
}

.login-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    background: var(--light);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.login-tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.login-tab.active {
    background: white;
    box-shadow: var(--shadow);
    color: var(--primary);
}

/* Teacher Dashboard */
.dashboard-header {
    background: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    margin-bottom: 0.5rem;
}

.class-code {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--baby-yellow);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Prompt Type Selector */
.prompt-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.prompt-type-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-type-btn:hover {
    border-color: var(--primary);
}

.prompt-type-btn.selected {
    border-color: var(--primary);
    background: var(--baby-green);
}

.prompt-type-btn i {
    font-size: 1.5rem;
}

/* Checkbox toggle */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle {
    width: 50px;
    height: 28px;
    background: #E0E0E0;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.toggle.active {
    background: var(--success);
}

.toggle.active::after {
    transform: translateX(22px);
}

/* Mobile Bottom Nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    padding: 0.5rem;
    z-index: 100;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--gray);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.mobile-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.mobile-nav-item.active {
    color: var(--primary);
}

@media (max-width: 768px) {
    .mobile-nav {
        display: block;
    }

    body {
        padding-bottom: 70px;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .nav-links.student-nav {
        display: none;
    }

    .nav-links {
        gap: 0.25rem;
    }

    /* Hide text in nav links, show only icons */
    .nav-links a {
        font-size: 0;
        padding: 0.5rem;
    }

    .nav-links a i {
        font-size: 1.1rem;
    }

    .logo {
        font-size: 1rem;
    }

    .logo i {
        font-size: 1.2rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    .container-wide {
        padding: 0.75rem;
    }

    .card {
        padding: 1rem;
        border-radius: 12px;
    }

    /* Mobile stats - always 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Dashboard header mobile */
    .dashboard-header {
        padding: 1rem;
    }

    .dashboard-header h1 {
        font-size: 1.25rem;
    }

    .dashboard-header .d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    .dashboard-header .btn-lg {
        width: 100%;
        margin-top: 1rem;
    }

    .class-code {
        font-size: 1.25rem;
    }

    /* Tables on mobile */
    .table-responsive {
        margin: 0 -0.5rem;
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.85rem;
        min-width: 100%;
    }

    .table th,
    .table td {
        padding: 0.6rem 0.4rem;
    }

    .table .d-flex {
        flex-wrap: nowrap;
    }

    /* Hide/show on mobile */
    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: inline;
    }

    /* Compact avatar in tables */
    .table .avatar {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    /* Compact action buttons on mobile */
    .table .btn-sm {
        padding: 0.3rem 0.45rem;
        font-size: 0.7rem;
    }

    /* Keep action buttons inline */
    .action-buttons {
        display: flex;
        gap: 0.25rem;
        flex-wrap: nowrap;
    }

    .action-buttons form {
        display: inline;
    }

    /* Mobile student list */
    .student-list-mobile {
        display: block;
    }

    .student-list-desktop {
        display: none;
    }

    /* Prompt types grid - 2 columns on mobile */
    .prompt-types {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .prompt-type-btn {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .prompt-type-btn i {
        font-size: 1.25rem;
    }

    .prompt-type-btn span {
        font-size: 0.8rem;
    }

    /* Smaller buttons on mobile */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 25px;
    }

    .btn-lg {
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
    }

    .btn i {
        font-size: 0.85rem;
    }

    /* Smaller empty state on mobile */
    .empty-state {
        padding: 1.5rem 1rem;
    }

    .empty-state i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .empty-state h3 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .empty-state p {
        font-size: 0.85rem;
    }

    /* Prompt icons smaller on mobile */
    .prompt-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }

    /* Stats grid - always 2 columns on mobile */
    .stats-grid-4,
    .stats-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Profile/baby avatars smaller */
    .baby-avatar,
    .profile-avatar {
        width: 70px !important;
        height: 70px !important;
        font-size: 2rem !important;
    }

    /* Camera buttons smaller */
    .camera-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.2rem !important;
    }

    .camera-btn.secondary {
        width: 40px !important;
        height: 40px !important;
    }

    /* Color picker - more columns fit */
    .color-picker {
        grid-template-columns: repeat(8, 1fr) !important;
        gap: 0.25rem !important;
    }

    /* Room picker - 2 columns on mobile */
    .room-picker {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Form improvements */
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .form-input,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom */
    }

    /* Response cards */
    .response-card {
        padding: 0.875rem;
    }

    /* Grading form mobile */
    .response-card form .d-flex {
        flex-direction: column;
    }

    .response-card form .form-select,
    .response-card form .form-input {
        width: 100%;
    }

    .response-card form .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Modal improvements */
    #cameraModal > div {
        margin-bottom: env(safe-area-inset-bottom, 1rem);
    }
}

/* Extra small devices */
@media (max-width: 380px) {
    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .prompt-types {
        grid-template-columns: 1fr 1fr;
    }
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 90px;
    right: 1rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 99;
}

.fab:hover {
    transform: scale(1.1);
}

@media (min-width: 769px) {
    .fab {
        bottom: 2rem;
    }
}

/* Responsive visibility */
.show-mobile {
    display: none;
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--gray); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Celebration Animation */
@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.celebrate {
    animation: celebrate 0.5s ease;
}

/* Baby avatar bounce */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.bounce {
    animation: bounce 0.5s ease;
}

/* Footer */
.footer {
    padding: 2rem;
    text-align: center;
    background: #333;
    color: #aaa;
    font-size: 0.9rem;
}

.footer a {
    color: var(--primary);
}

.footer p + p {
    margin-top: 0.5rem;
}
