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

:root {
    --primary: #e73a46;
    --primary-dark: #c9313c;
    --secondary: #000657;
    --success: #22c55e;
    --danger: #e73a46;
    --warning: #f59e0b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #000657;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Pages */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #000657 0%, #e73a46 100%);
    padding: 20px;
}

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

.login-logo {
    display: block;
    max-width: 200px;
    height: auto;
    margin: 0 auto 20px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231, 58, 70, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

/* Error Message */
.error-message {
    color: var(--danger);
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

/* Header */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 15px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 70px;
    width: auto;
}

.header h1 {
    font-size: 24px;
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-actions span {
    color: var(--text-muted);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 20px;
}

.nav-btn {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    color: var(--text-dark);
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-light);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    background: var(--bg-light);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.tab-header h2 {
    font-size: 20px;
}

/* Tables */
.table-container {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-light);
}

.actions-cell {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-dark);
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Assignments */
.assignments-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.assignment-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.assignment-card h3 {
    margin-bottom: 20px;
    font-size: 16px;
}

.checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
}

.checkbox-item:hover {
    background: var(--bg-light);
}

.checkbox-item input {
    margin-right: 10px;
    cursor: pointer;
}

.assignment-list {
    max-height: 300px;
    overflow-y: auto;
}

.assignment-item {
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 10px;
}

.assignment-item h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.assignment-item .users {
    font-size: 12px;
    color: var(--text-muted);
}

/* User Dashboard */
.user-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.user-container h2 {
    margin-bottom: 25px;
}

.titles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.title-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.title-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.title-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 15px;
}

.title-card a {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.title-card a:hover {
    text-decoration: underline;
}

.no-content {
    text-align: center;
    color: var(--text-muted);
    padding: 50px;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 3000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

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

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        gap: 10px;
        overflow-x: auto;
    }

    .nav-btn {
        white-space: nowrap;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .assignments-grid {
        grid-template-columns: 1fr;
    }

    .titles-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }
}

/* Notification Button */
.btn-notification {
    position: relative;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 20px;
}

.bell-icon {
    display: inline-block;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #ffffff !important;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.nav-btn.active .nav-badge {
    background: white;
    color: var(--primary);
}

/* User Sections */
.user-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Selectable Title Card */
.title-card.selectable {
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

.title-card.selectable:hover {
    border-color: var(--primary);
}

.title-card.selectable.selected {
    border-color: var(--primary);
    background: rgba(231, 58, 70, 0.05);
}

.title-card .checkbox-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.title-card.selected .checkbox-indicator {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.title-card .checkbox-indicator::after {
    content: '';
}

.title-card.selected .checkbox-indicator::after {
    content: '\2713';
    font-weight: bold;
}

.title-card .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.approved {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #f3f4f6;
    color: #6b7280;
}

/* Requests List */
.requests-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.request-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.request-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.request-info p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 3px;
}

.request-actions {
    display: flex;
    gap: 10px;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

/* Request History */
.requests-history {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.request-history-card {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 15px;
    box-shadow: var(--shadow);
}

.request-history-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.request-history-card .date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Notifications Modal */
.modal-wide {
    max-width: 600px;
}

.modal-body {
    padding: 20px;
}

.notifications-actions {
    margin-bottom: 15px;
    text-align: right;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--bg-light);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(231, 58, 70, 0.05);
    border-left: 3px solid var(--primary);
}

.notification-item .message {
    font-size: 14px;
    margin-bottom: 5px;
}

.notification-item .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input {
    width: auto;
}

/* Category Management */
.category-manager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.category-panel,
.subcategory-panel {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.panel-header h3 {
    font-size: 16px;
    margin: 0;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-item:hover {
    background: var(--border);
}

.category-item.selected {
    background: var(--primary);
    color: white;
}

.category-item.selected .btn-secondary {
    background: rgba(255,255,255,0.2);
    border-color: transparent;
    color: white;
}

.category-name {
    font-weight: 500;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.hint-text {
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.no-content-small {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.modal-small {
    max-width: 400px;
}

/* User View - Grouped Categories */
.category-group {
    margin-bottom: 30px;
}

.category-heading {
    font-size: 22px;
    color: var(--primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 20px;
}

.subcategory-group {
    margin-bottom: 20px;
    padding-left: 10px;
}

.subcategory-heading {
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid var(--border);
}

@media (max-width: 768px) {
    .category-manager {
        grid-template-columns: 1fr;
    }
}
