* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #3f51b5;
    --secondary: #303f9f;
    --accent: #ff4081;
    --accent2: #7c4dff;
    --accent3: #00bcd4;
    --light: #f5f5f5;
    --dark: #263238;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

body {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: var(--dark);
    min-height: 100vh;
    padding-bottom: 2rem;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 3rem;
}

header {
    text-align: center;
    padding: 2.5rem 0;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    border-radius: 0 0 25px 25px;
    box-shadow: var(--shadow);
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.07)"/></svg>');
    background-size: 100% 100%;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 18px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.card-title {
    color: var(--secondary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 3px solid var(--accent);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
}

.card-title i {
    margin-right: 0.8rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.2rem;
}

label {
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--secondary);
}

input, select, button, textarea {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    outline: none;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: #e91e63;
    transform: translateY(-2px);
}

button i {
    margin-right: 0.7rem;
}

.btn-generate {
    background: var(--secondary);
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 12px;
}

.btn-generate:hover {
    background: #283593;
    transform: translateY(-3px) scale(1.02);
}

.btn-save {
    background: #4caf50;
    margin-left: 1rem;
}

.btn-load {
    background: #ff9800;
    margin-left: 1rem;
}

.timetable-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin: 1.5rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: center;
    border: 1px solid #e0e0e0;
}

th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #e9ecef;
}

.lunch-break {
    background-color: #fff8e1;
    font-weight: bold;
    color: #ff8f00;
}

.lab-period {
    background-color: #e8f5e9;
    font-weight: bold;
}

.teacher-card {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 12px;
    margin-bottom: 0.8rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.teacher-card:hover {
    transform: translateX(5px);
}

.teacher-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.3rem;
    margin-right: 1.2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.teacher-info {
    flex-grow: 1;
}

.teacher-info h3 {
    margin-bottom: 0.4rem;
    color: var(--secondary);
}

.subject-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    margin: 0.2rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.section-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    background: var(--primary);
}

.section-btn.active {
    background: var(--accent);
    transform: scale(1.05);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-box {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    padding: 1.2rem;
    border-radius: 12px;
    text-align: center;
    min-width: 180px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-box:hover {
    transform: translateY(-5px);
}

.stat-box h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.animated {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.visible {
    opacity: 1;
    transform: translateY(0);
}

.spinner {
    width: 25px;
    height: 25px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.teacher-specialization {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.subject-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.config-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.config-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
}


.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 1rem 0;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.feature-item {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}
.feature-item i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 1rem;
}
.feature-item h4 {
    font-size: 1.1rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}
.feature-item p {
    font-size: 0.9rem;
    color: #555;
}

.section-config {
    background: #f5f5f5;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.half-preference {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.preference-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: #e0e0e0;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.preference-btn.active {
    background: var(--accent);
    color: white;
}

.firebase-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: 8px;
    background: #4caf50;
    color: white;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}




.config-heading-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.config-heading {
    margin-bottom: 1rem;
    color: var(--secondary);
}


.add-teacher-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #ccc;
    text-align: center;
}


.add-btn {
    background: var(--primary);
    width: auto;
    padding: 0.8rem 1.5rem;
}
.add-btn:hover {
    background: var(--secondary);
}


.teacher-input-group {
    background: #fdfdff;
    padding: 1.5rem;
    border: 1px solid #e8eaf6;
    border-radius: 10px;
    margin-bottom: 1rem;
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


.teacher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.remove-teacher-btn {
    background: transparent;
    border: none;
    color: var(--dark);
    opacity: 0.4;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s ease;
}
.remove-teacher-btn:hover {
    color: #e53935;
    opacity: 1;
}




@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    h1 {
        font-size: 2.2rem;
    }
    .card {
        padding: 1.5rem;
    }
    
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    .controls .btn-generate, .controls .btn-save, .controls .btn-load {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .stats {
        flex-direction: column;
    }
    .stat-box {
        width: 100%;
    }

    
    .config-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .config-controls .input-group, .config-controls .config-btn {
        width: 100%;
    }
    

    .teacher-specialization {
        grid-template-columns: 1fr;
    }
}