:root {
    --bg-color: #f8fafc;
    --table-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-color: #cbd5e1;
    
    /* Slot colors matching original image slightly modernized */
    --theory-header-bg: #dbeafe; /* Light Blue */
    --lab-header-bg: #bae6fd; /* Sky Blue */
    --cell-bg: #fef9c3; /* Yellowish */
    --cell-hover: #fef08a;
    
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    
    --lunch-bg: #e2e8f0;
    
    /* Active Slot styling */
    --theory-active-bg: #bfdbfe;
    --lab-active-bg: #fed7aa;
    
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.actions {
    display: flex;
    gap: 1rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #1e293b, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(1px);
}

.secondary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background-color: #f1f5f9;
}

.table-wrapper {
    background: var(--table-bg);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

table {
    border-collapse: collapse;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    font-size: 0.85rem;
    min-width: 90px;
    height: 60px;
}

.theory-hours th {
    background-color: var(--theory-header-bg);
    color: var(--text-primary);
    font-weight: 600;
}

.lab-hours th {
    background-color: var(--lab-header-bg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
}

.day-col {
    background-color: #f1f5f9;
    font-weight: 700;
    position: sticky;
    left: 0;
    z-index: 10;
}

.lunch-col {
    background-color: var(--lunch-bg);
    font-weight: 700;
    letter-spacing: 2px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    padding: 1rem 0.2rem;
}

.slot-cell {
    background-color: var(--cell-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.slot-cell:hover {
    background-color: var(--cell-hover);
    transform: scale(1.02);
    z-index: 5;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.slot-cell.has-data.theory-type {
    background-color: var(--theory-active-bg);
}

.slot-cell.has-data.lab-type {
    background-color: var(--lab-active-bg);
}

.slot-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1.2;
}

.slot-default {
    color: #64748b;
    font-weight: 500;
}

.slot-course-code {
    font-size: 0.7rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 2px;
}

.slot-subject {
    font-weight: 700;
    font-size: 0.85rem;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.slot-teacher {
    font-size: 0.75rem;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.slot-venue {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
    font-weight: 600;
}

.slot-type-badge {
    letter-spacing: 0.5px;
}

.subject-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
    font-size: 0.85rem;
}

.teacher-name, .venue-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    width: 90%;
    max-width: 450px;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.5);
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #fff;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-label {
    flex: 1;
    cursor: pointer;
}

.radio-label input {
    display: none;
}

.radio-custom {
    display: block;
    text-align: center;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.5);
}

.radio-label input:checked + .radio-custom {
    border-color: var(--primary-color);
    background-color: #eff6ff;
    color: var(--primary-color);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    align-items: center;
}

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

.btn-clear {
    color: #ef4444;
    background: none;
    border: 1px solid #fca5a5;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: #fef2f2;
}

.btn-cancel {
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f1f5f9;
}

.btn-save {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
}

.btn-save:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.4);
}

/* Custom Scrollbar for better UI */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .app-container {
        padding: 0;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 1rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 1.4rem;
        text-align: center;
    }

    .actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .primary-btn, .secondary-btn {
        width: 100%;
        justify-content: center;
        padding: 0.85rem;
    }

    .table-wrapper {
        padding: 0.5rem;
        border-radius: 12px;
    }

    th, td {
        padding: 0.4rem;
        min-width: 75px;
        height: 70px;
    }

    .course-code {
        font-size: 0.75rem;
    }

    .subject-name {
        font-size: 0.75rem;
    }

    .teacher-name, .venue-name {
        font-size: 0.65rem;
    }

    .modal {
        width: 95%;
        padding: 1.5rem 1rem;
    }

    .modal h2 {
        font-size: 1.3rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .right-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-clear, .btn-cancel, .btn-save {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}
