/* 1. Consolidated Font Imports (Matching main.css) */
@import url("https://fonts.googleapis.com/css2?family=Amarante&family=Poppins:wght@300;400;500;600;700&family=Radley:ital@0;1&display=swap");

:root {
    /* Colors */
    --primary-color: #1E4A4A;
    --primary-rgb: 30, 74, 74;
    --primary-hover: #2a5e5e;
    --secondary-color: #082A57;
    --secondary-hover: #0d3872;
    
    /* Typography Variables */
    --font-body: 'Poppins', sans-serif;
    --font-heading: 'Amarante', cursive;
    --font-accent: 'Radley', serif;

    /* Shadows & Transitions */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    color: #333;
    background-color: #f8f9fa;
    /* Optimized background pattern matching main.css */
    background-image: radial-gradient(#e9ecef 1px, transparent 1px),
        radial-gradient(#e9ecef 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

@keyframes subtleShift {
    0% { background-position: 0 0, 10px 10px; }
    50% { background-position: 2px 2px, 12px 12px; }
    100% { background-position: 0 0, 10px 10px; }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-body); /* Kept Poppins for Admin readability, can switch to heading font if preferred */
    letter-spacing: -0.02em;
    color: var(--primary-color);
}

/* Base Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.4;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn i {
    font-size: 1rem;
}

/* Primary Button */
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Secondary Button */
.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: rgba(var(--primary-rgb), 0.05);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    transform: translateY(0);
    background-color: rgba(var(--primary-rgb), 0.1);
}

/* Button Groups */
.btn + .btn {
    margin-left: 0.75rem;
}

/* Small Button Variant */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.813rem;
}

/* Large Button Variant */
.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Disabled State */
.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    pointer-events: none;
}

/* Loading State */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid;
    border-radius: 50%;
    border-color: #fff #fff #fff transparent;
    animation: button-loading-spinner 0.75s linear infinite;
}

@keyframes button-loading-spinner {
    from { transform: rotate(0turn); }
    to { transform: rotate(1turn); }
}

.card {
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background-color: rgba(var(--primary-rgb), 0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    border-radius: 20px 20px 0 0 !important;
    padding: 1.5rem 2rem;
}

.form-control {
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(var(--primary-rgb), 0.1);
    transition: var(--transition-base);
    font-family: var(--font-body);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
    outline: none;
}

/* Custom Link Styles */
.kt-link {
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
    font-weight: 500;
    transition: var(--transition-base);
}

.kt-link::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

.kt-link:hover {
    color: var(--secondary-color);
}

.kt-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
    background-color: var(--secondary-color);
}

/* Role Checkboxes Section */
.role-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

/* Individual checkbox container */
.form-check {
    margin: 0;
    padding: 0;
    position: relative;
}

/* Custom checkbox design */
.form-check-input {
    display: none;
}

.form-check-label {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 0;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-base);
    background-color: white;
    position: relative;
}

/* Custom checkbox indicator */
.form-check-label::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    margin-right: 10px;
    transition: all 0.2s ease;
    background-color: white;
}

/* Checkmark */
.form-check-label::after {
    content: '✓';
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%) scale(0);
    color: white;
    font-size: 12px;
    transition: transform 0.2s ease;
}

/* Hover state */
.form-check-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.02);
}

.form-check-label:hover::before {
    border-color: var(--primary-color);
}

/* Checked state */
.form-check-input:checked + .form-check-label {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.05);
}

.form-check-input:checked + .form-check-label::before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:checked + .form-check-label::after {
    transform: translateY(-50%) scale(1);
}

/* Focus state for accessibility */
.form-check-input:focus + .form-check-label {
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.25);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .role-checkboxes {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .form-check-label {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Alert Base Styles */
.custom-alert {
    position: relative;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

/* Alert Types */
.custom-alert.success {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.05);
}

.custom-alert.error {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.custom-alert.warning {
    border-color: #ffc107;
    background-color: rgba(255, 193, 7, 0.05);
}

.custom-alert.info {
    border-color: #0dcaf0;
    background-color: rgba(13, 202, 240, 0.05);
}

/* Alert Content Layout */
.custom-alert .alert-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

/* Alert Icon Styles */
.custom-alert .alert-icon {
    padding: 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.custom-alert.success .alert-icon {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
}

.custom-alert.error .alert-icon {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.custom-alert.warning .alert-icon {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.custom-alert.info .alert-icon {
    background-color: rgba(13, 202, 240, 0.1);
    color: #0dcaf0;
}

/* Alert Text Styles */
.custom-alert .alert-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.custom-alert .alert-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.custom-alert.error .alert-title { color: #dc3545; }
.custom-alert.warning .alert-title { color: #997404; }
.custom-alert.info .alert-title { color: #055160; }

.custom-alert .alert-description {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.7);
    line-height: 1.4;
}

/* Close Button Styles */
.custom-alert .close-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    margin-left: 1rem;
    border-radius: 12px;
    cursor: pointer;
    color: var(--primary-color);
    opacity: 0.6;
    transition: var(--transition-base);
}

.custom-alert .close-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Animation */
.custom-alert {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Password Toggle Styles */
.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.password-toggle:hover {
    opacity: 1;
    color: var(--secondary-color);
}

.language-switcher {
    position: fixed;
    margin-left: auto;
    top: 1rem;
    right: 1rem;
    z-index: 101;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 0.75rem;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(5px);
}

.language-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.language-buttons {
    display: flex;
    gap: 0.25rem;
}

.language-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    color: var(--primary-color);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition-base);
    text-decoration: none;
}

.language-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.language-btn:hover:not(.active) {
    background: rgba(var(--primary-rgb), 0.1);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background-color: #f8f9fa;
}

a.btn-icon {
    text-decoration: none;
}

/* Quick Access Grid for Dashboards*/
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.quick-access-card {
    background: white;
    border-radius: 15px;
    padding: 1.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-sm);
}

.quick-access-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition-base);
}

.quick-access-card:hover .card-icon {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.quick-access-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-family: var(--font-heading);
}

.quick-access-card p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-container {
        padding-left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 0 1rem 1rem;
    }
}

@media (max-width: 768px) {
    .quick-access-grid {
        grid-template-columns: 1fr;
    }
    
    .language-switcher {
        align-self: flex-end;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 4rem 0.5rem 0.5rem 0.5rem;
    }

    .quick-access-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
}