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

:root {
    --primary-color: #1a237e;
    --secondary-color: #b71c1c;
    --accent-color: #3949ab;
    --accent-hover: #5c6bc0;
    --border-color: #d0d0d0;
    --border-focus: #3949ab;
    --text-dark: #1a1a2e;
    --text-medium: #4a4a5a;
    --text-light: #6a6a7a;
    --bg-light: #f8f9fa;
    --input-height: 48px;
    --border-radius: 10px;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a237e 0%, #4a1942 50%, #b71c1c 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.95;
}

.warning {
    font-size: 0.95rem;
    color: #fff;
    background: rgba(255, 193, 7, 0.25);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    display: inline-block;
    font-weight: 500;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    padding: 10px;
}

.download-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-width: 380px;
}

.download-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-light);
}

.card-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-header h2 {
    color: var(--text-dark);
    font-size: 1.35rem;
    font-weight: 600;
}

.card-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.select-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.select-group {
    width: 100%;
}

.select-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.875rem;
}

.select-group select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    height: var(--input-height);
    color: var(--text-dark);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a6a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.select-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.15);
}

.select-group select:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
    color: var(--text-light);
}

.date-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.date-group {
    width: 100%;
}

.date-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.875rem;
}


.checkbox-group {
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-medium);
    font-size: 0.875rem;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
    border-radius: 4px;
}

.checkbox-label span {
    user-select: none;
}

.date-group input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    height: var(--input-height);
    color: var(--text-dark);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a6a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.date-group input::-webkit-calendar-picker-indicator {
    opacity: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.date-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.15);
}

.download-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: var(--input-height);
    letter-spacing: 0.3px;
}

.download-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.35);
}

.download-btn:active {
    transform: scale(0.98);
}

.download-btn:disabled {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.btn-icon {
    font-size: 1.1rem;
}

.status-message {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
}

.status-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.status-message.error {
    display: block;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.status-message.loading {
    display: block;
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffe082;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .date-inputs,
    .select-inputs {
        flex-direction: column;
        gap: 15px;
    }

    main {
        grid-template-columns: 1fr;
    }
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* Custom facility dropdown with checkboxes */
.facility-dropdown {
    position: relative;
    width: 100%;
}

.facility-dropdown-toggle {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    height: var(--input-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.facility-dropdown-toggle:hover {
    border-color: var(--border-focus);
}

.facility-dropdown-toggle .selected-text {
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.facility-dropdown-toggle .dropdown-arrow {
    color: var(--text-light);
    width: 12px;
    height: 12px;
    transition: transform 0.3s ease;
    margin-left: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a6a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.facility-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.facility-dropdown.disabled .facility-dropdown-toggle {
    background: var(--bg-light);
    cursor: not-allowed;
    color: var(--text-light);
}

.facility-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-focus);
    border-radius: var(--border-radius);
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.facility-dropdown.open .facility-dropdown-menu {
    display: block;
}

.facility-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    font-family: 'Poppins', sans-serif;
}

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

.facility-option:hover {
    background: rgba(57, 73, 171, 0.08);
}

.facility-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.facility-option label {
    cursor: pointer;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 400;
}

.facility-option.select-all {
    background: rgba(57, 73, 171, 0.05);
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.facility-option.select-all label {
    font-weight: 600;
}

.facility-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    font-size: 0.9rem;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 400;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    height: var(--input-height);
    color: var(--text-dark);
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.15);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-light);
}

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

.password-input-wrapper input {
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.toggle-password:hover {
    opacity: 1;
}

.login-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    margin-top: 28px;
}

.login-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.35);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn:disabled {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--bg-light);
}

.login-footer p {
    color: var(--text-light);
    font-size: 0.8rem;
}

/* Dashboard header with logout */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    text-align: left;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.user-info span {
    color: white;
    font-size: 0.9rem;
}

.user-info .username {
    font-weight: 600;
}

.logout-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-left {
        text-align: center;
    }
}
