@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: 210, 100%, 45%; /* #0066e2 */
    --primary-hover: 210, 100%, 40%;
    --primary-gradient: linear-gradient(135deg, hsl(210, 100%, 45%), hsl(260, 90%, 55%));
    --accent: 260, 90%, 55%;
    
    --bg-main: 220, 30%, 96%;
    --bg-dark: 222, 47%, 11%;
    --surface: 0, 0%, 100%;
    --surface-glass: rgba(255, 255, 255, 0.75);
    --border-color: 220, 15%, 88%;
    --border-glass: rgba(255, 255, 255, 0.4);
    
    --text-main: 222, 47%, 15%;
    --text-muted: 220, 15%, 45%;
    --text-light: 0, 0%, 100%;
    
    --success: 142, 70%, 45%;
    --success-bg: 142, 70%, 95%;
    --warning: 38, 92%, 50%;
    --warning-bg: 38, 92%, 95%;
    --danger: 350, 80%, 50%;
    --danger-bg: 350, 80%, 95%;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 8px 24px rgba(149, 157, 165, 0.1);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Dark Mode Overrides (Optional / Selective Use) */
.dark-theme {
    --bg-main: 222, 47%, 8%;
    --surface: 222, 47%, 12%;
    --surface-glass: rgba(15, 23, 42, 0.8);
    --border-color: 222, 20%, 20%;
    --border-glass: rgba(255, 255, 255, 0.05);
    --text-main: 210, 40%, 98%;
    --text-muted: 215, 20%, 65%;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: hsl(var(--bg-main));
    color: hsl(var(--text-main));
    line-height: 1.6;
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 102, 226, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: hsl(var(--text-main));
}

a {
    color: hsl(var(--primary));
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover {
    color: hsl(var(--primary-hover));
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Glassmorphism Wrapper */
.glass-panel {
    background: var(--surface-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Header & Navbar */
.main-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid hsl(var(--border-color));
    position: relative;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    padding: 12px 0;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(0, 102, 226, 0.3);
}

.logo-text h1 {
    font-size: 1.15rem;
    line-height: 1.2;
}
.logo-text p {
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
    font-weight: 500;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 8px;
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 226, 0.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 102, 226, 0.3);
}

.btn-secondary {
    background: hsl(var(--bg-main));
    color: hsl(var(--text-main));
    border: 1px solid hsl(var(--border-color));
}
.btn-secondary:hover {
    background: hsl(var(--border-color));
}

.btn-danger {
    background: hsl(var(--danger));
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Authentication Layout (Login Screen) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    display: inline-flex;
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    color: white;
    font-size: 2rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(0, 102, 226, 0.25);
}

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: hsl(var(--text-main));
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--border-color));
    background: white;
    font-family: inherit;
    font-size: 0.95rem;
    color: hsl(var(--text-main));
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 4px rgba(0, 102, 226, 0.15);
}

/* Dashboard Tab Panel Layout */
.tab-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid hsl(var(--border-color));
    margin-bottom: 24px;
    padding-bottom: 2px;
}

.tab-btn {
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    color: hsl(var(--text-muted));
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 3px 3px 0 0;
    transform: scaleX(0);
    transition: transform var(--transition-fast);
}

.tab-btn:hover {
    color: hsl(var(--text-main));
}

.tab-btn.active {
    color: hsl(var(--primary));
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-normal);
}

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

/* Searchable Combobox (Custom Dropdown) */
.combobox-container {
    position: relative;
}

.combobox-input-wrapper {
    position: relative;
}

.combobox-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: hsl(var(--text-muted));
    transition: transform var(--transition-fast);
}

.combobox-clear {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: hsl(var(--text-muted));
    font-size: 1.25rem;
    font-weight: bold;
    display: none;
    z-index: 10;
    transition: color var(--transition-fast);
    line-height: 1;
}

.combobox-clear:hover {
    color: hsl(var(--danger));
}

#asn-search {
    padding-right: 56px;
}

.combobox-dropdown {
    position: absolute;
    top: 102%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.combobox-option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    border-bottom: 1px solid hsl(var(--bg-main));
}

.combobox-option:last-child {
    border-bottom: none;
}

.combobox-option:hover {
    background-color: hsl(var(--bg-main));
}

.combobox-option.selected {
    background: rgba(0, 102, 226, 0.08);
    color: hsl(var(--primary));
    font-weight: 600;
}

.combobox-no-results {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: hsl(var(--text-muted));
    text-align: center;
}

/* Selected ASN Info Card */
.asn-info-card {
    background: rgba(0, 102, 226, 0.04);
    border-left: 4px solid hsl(var(--primary));
    padding: 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 12px;
    display: none;
    animation: slideDown var(--transition-fast);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.asn-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.asn-info-item label {
    display: block;
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
    font-weight: 600;
    text-transform: uppercase;
}

.asn-info-item span {
    font-size: 0.9rem;
    font-weight: 600;
    color: hsl(var(--text-main));
}

/* Evaluation Form Period Selection Grid */
.period-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Questionnaire Group Card Layout */
.indicator-section {
    margin-top: 32px;
}

.group-title {
    background: var(--primary-gradient);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: 1rem;
    font-weight: 600;
}

.group-body {
    background: white;
    border: 1px solid hsl(var(--border-color));
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 8px 0;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.question-row {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border-color));
}

.question-row:last-child {
    border-bottom: none;
}

.question-text {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
}

.question-num {
    color: hsl(var(--primary));
    font-weight: 700;
}

/* Modern Radio Button Rating Cards */
.rating-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rating-option {
    position: relative;
    flex: 1;
    min-width: 60px;
    max-width: 140px;
}

.rating-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.rating-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    font-size: 0.9rem;
    background: hsl(var(--bg-main));
    text-align: center;
}

.rating-label .rating-text {
    font-size: 0.65rem;
    color: hsl(var(--text-muted));
    font-weight: 500;
    margin-top: 2px;
}

/* Colors for active rating options */
.rating-option.r1:hover .rating-label,
.rating-option.r1 input[type="radio"]:checked + .rating-label {
    background-color: rgba(220, 38, 38, 0.08);
    border-color: hsl(var(--danger));
    color: hsl(var(--danger));
}

.rating-option.r2:hover .rating-label,
.rating-option.r2 input[type="radio"]:checked + .rating-label {
    background-color: rgba(249, 115, 22, 0.08);
    border-color: hsl(var(--warning));
    color: hsl(var(--warning));
}

.rating-option.r3:hover .rating-label,
.rating-option.r3 input[type="radio"]:checked + .rating-label {
    background-color: rgba(234, 179, 8, 0.08);
    border-color: hsl(45, 100%, 45%);
    color: hsl(45, 100%, 40%);
}

.rating-option.r4:hover .rating-label,
.rating-option.r4 input[type="radio"]:checked + .rating-label {
    background-color: rgba(132, 204, 22, 0.08);
    border-color: hsl(84, 80%, 40%);
    color: hsl(84, 80%, 35%);
}

.rating-option.r5:hover .rating-label,
.rating-option.r5 input[type="radio"]:checked + .rating-label {
    background-color: rgba(34, 197, 94, 0.08);
    border-color: hsl(var(--success));
    color: hsl(var(--success));
}

.rating-option input[type="radio"]:checked + .rating-label {
    transform: scale(1.03);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Stats Widgets Grid (Admin) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(0, 102, 226, 0.08);
    color: hsl(var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.success {
    background: rgba(34, 197, 94, 0.08);
    color: hsl(var(--success));
}

.stat-icon.warning {
    background: rgba(249, 115, 22, 0.08);
    color: hsl(var(--warning));
}

.stat-info h4 {
    font-size: 1.8rem;
    line-height: 1.1;
}

.stat-info p {
    font-size: 0.8rem;
    color: hsl(var(--text-muted));
    font-weight: 600;
    text-transform: uppercase;
}

/* Alert Boxes */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background-color: hsl(var(--success-bg));
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: hsl(var(--success));
}

.alert-danger {
    background-color: hsl(var(--danger-bg));
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: hsl(var(--danger));
}

/* Tables and Panels */
.panel {
    background: white;
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

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

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.table th {
    background-color: hsl(var(--bg-main));
    padding: 12px 16px;
    font-weight: 600;
    color: hsl(var(--text-main));
    border-bottom: 1px solid hsl(var(--border-color));
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border-color));
    color: hsl(var(--text-main));
    vertical-align: middle;
}

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

.table tr:hover td {
    background-color: rgba(0, 102, 226, 0.01);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: hsl(var(--success-bg));
    color: hsl(var(--success));
}

.badge-warning {
    background: hsl(var(--warning-bg));
    color: hsl(var(--warning));
}

.badge-danger {
    background: hsl(var(--danger-bg));
    color: hsl(var(--danger));
}

.badge-info {
    background: rgba(0, 102, 226, 0.05);
    color: hsl(var(--primary));
}

/* Rating score label styles */
.score-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
    display: inline-block;
    text-align: center;
}

.score-high {
    background-color: hsl(var(--success-bg));
    color: hsl(var(--success));
}

.score-med {
    background-color: hsl(var(--warning-bg));
    color: hsl(var(--warning));
}

.score-low {
    background-color: hsl(var(--danger-bg));
    color: hsl(var(--danger));
}

/* Modals & Forms CRUD */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-20px);
    transition: transform var(--transition-fast);
}

.modal-backdrop.open .modal-content {
    transform: translateY(0);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--text-muted));
}

/* Footer styling */
.main-footer {
    margin-top: auto;
    padding: 20px 0;
    background-color: white;
    border-top: 1px solid hsl(var(--border-color));
    text-align: center;
    font-size: 0.8rem;
    color: hsl(var(--text-muted));
    font-weight: 500;
}

/* Pagination styles */
.pagination {
    display: inline-flex;
    list-style: none;
    gap: 6px;
    padding-left: 0;
}

.page-item {
    display: inline;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 8px 12px;
    background: white;
    border: 1px solid hsl(var(--border-color));
    border-radius: var(--radius-sm);
    color: hsl(var(--text-main));
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(0, 102, 226, 0.25);
}

.page-item.disabled .page-link {
    opacity: 0.4;
    cursor: not-allowed;
    background: hsl(var(--bg-main));
}

.page-link:hover:not(.active):not(.disabled) {
    background: hsl(var(--bg-main));
    border-color: hsl(var(--primary));
    color: hsl(var(--primary));
}

/* Mobile Responsiveness Rules */
@media (max-width: 768px) {
    .nav-wrapper {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .user-profile {
        flex-direction: column;
        gap: 8px;
    }
    .user-info {
        text-align: center;
    }
    .period-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .rating-group {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }
    .rating-option {
        min-width: unset;
        max-width: none;
    }
    .rating-label {
        font-size: 0.85rem;
        padding: 8px 4px;
    }
    .rating-label .rating-text {
        display: none; /* Hide description on mobile for space */
    }
    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }
    .btn {
        width: 100%;
    }
}

/* ===================================
   PAGINATION COMPONENT
   =================================== */
.pagination {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.page-item {
    display: flex;
}

.page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid hsl(var(--border-color));
    background: hsl(var(--surface));
    color: hsl(var(--text-main));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    line-height: 1;
}

.page-item .page-link:hover {
    background: hsl(var(--primary) / 0.08);
    border-color: hsl(var(--primary) / 0.4);
    color: hsl(var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px hsl(var(--primary) / 0.12);
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    border-color: transparent;
    color: hsl(var(--text-light));
    font-weight: 700;
    box-shadow: 0 4px 12px hsl(var(--primary) / 0.35);
}

.page-item.active .page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px hsl(var(--primary) / 0.45);
}

.page-item.disabled .page-link {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: hsl(var(--bg-main));
}

