* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body & Root */
html,
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f7fafc;
    color: #2d3748;
    height: 100%;
    /* Ensure full height */
    line-height: 1.6;
}

/* Layout */
#app {
    width: 100%;
    height: 100%;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.content-area {
    padding: 30px;
    flex: 1;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e8e8;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: #fafafa;
}

th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    font-size: 14px;
    border-bottom: 2px solid #e8e8e8;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

tr:hover {
    background: #fafafa;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-outline {
    background: transparent;
    border: 1px solid #dcdfe6;
    color: #606266;
}

.btn-outline:hover {
    color: #409eff;
    border-color: #c6e2ff;
    background-color: #ecf5ff;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Loading & Empty */
.loading {
    text-align: center;
    color: #999;
    padding: 40px;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    /* Wider modal as requested */
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ... existing styles ... */

/* Compact Row for 5 items */
.form-row.compact {
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

@media (max-width: 768px) {
    .form-row.compact {
        grid-template-columns: repeat(2, 1fr);
    }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

/* Modal Form Styling */
/* Modal Form Styling */
.modal-body {
    padding: 16px;
    /* Reduced from 24px */
    overflow-y: auto;
    background-color: #f8f9fa;
}

.form-section {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    /* Reduced from 20px */
    margin-bottom: 12px;
    /* Reduced from 20px */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef1f5;
}

.form-section-title {
    font-size: 15px;
    /* Reduced from 16px */
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    /* Reduced from 16px */
    padding-bottom: 8px;
    /* Reduced from 10px */
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Weekday Selector Chips */
.weekday-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* Reduced from 10px */
    margin-top: 4px;
}

/* ... existing styles ... */

/* Adjusted Form Field Spacing */
.form-group label {
    font-size: 12px;
    /* Reduced from 13px */
    color: #718096;
    margin-bottom: 4px;
    /* Reduced from 6px */
    font-weight: 600;
}

.form-group {
    margin-bottom: 10px;
    /* Reduced from 20px globally for better compaction in modal */
}

.form-row {
    gap: 12px;
    /* Reduced from 20px */
}

.form-group input,
.form-group select {
    padding: 6px 10px;
    /* Compact inputs */
    font-size: 13px;
    height: 34px;
    /* Fixed smaller height */
}

/* Compact Row for 5 items */
.form-row.compact {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    /* Reduced from 15px */
}

.weekday-option {
    position: relative;
    cursor: pointer;
}

.weekday-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.weekday-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    color: #4a5568;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 60px;
}

.weekday-option:hover .weekday-chip {
    background-color: #edf2f7;
    border-color: #cbd5e0;
}

.weekday-option input:checked+.weekday-chip {
    background-color: #667eea;
    border-color: #667eea;
    color: white;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
}

/* Adjusted Form Field Spacing */
.form-group label {
    font-size: 13px;
    color: #718096;
    margin-bottom: 6px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    background-color: #fff;
    border: 1px solid #e2e8f0;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    vertical-align: middle;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch input:checked+.slider {
    background-color: #667eea;
}

.switch input:focus+.slider {
    box-shadow: 0 0 1px #667eea;
}


/* Loading Overlay Styles */
.table-container {
    position: relative;
    min-height: 200px;
}

.row-dimmed {
    opacity: 0.5;
    pointer-events: none;
    filter: blur(0.5px);
    transition: opacity 0.2s;
}

.loading-overlay-row {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: transparent !important;
    border: none !important;
}

.loading-overlay {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #4a5568;
    border: none !important;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Smart Pagination Styles */
.pagination-controls .btn-outline {
    background: white;
    border: 1px solid #e2e8f0;
    color: #4a5568;
}

.pagination-controls .btn-outline:hover:not(:disabled) {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.pagination-controls .btn-primary {
    border: 1px solid #667eea;
    /* Align border size */
}

.pagination-ellipsis {
    color: #a0aec0;
    padding: 0 4px;
    user-select: none;
}