/* 
 * Modern UI System (Refined)
 * A softer, sleeker utility-first CSS framework for PPDB SMKN 1 Gombong.
 */

:root {
    /* Colors - Softer Palette */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --secondary: #94a3b8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    /* Neutral */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #94a3b8;
    /* Darkened from #cbd5e1 */
    --slate-400: #64748b;
    /* Darkened from #94a3b8 */
    --slate-500: #475569;
    /* Darkened from #64748b */
    --slate-600: #334155;
    /* Darkened from #475569 */
    --slate-700: #1e293b;
    /* Darkened from #334155 */
    --slate-800: #0f172a;
    /* Darkened from #1e293b */
    --slate-900: #020617;
    /* Darkened from #0f172a */

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 76px;
    --header-height: 64px;
    --border-radius: 0.75rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Titillium Web', 'Inter', system-ui, sans-serif;
    background-color: var(--slate-50);
    color: var(--slate-600);
    font-size: 0.9375rem;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--slate-50);
}

::-webkit-scrollbar-thumb {
    background: var(--slate-200);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-300);
}

/* Typography - Less Bold */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    color: var(--slate-600);
    border-right: 1px solid var(--slate-100);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--slate-50);
}

.sidebar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--slate-900);
}

.sidebar-nav {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: var(--slate-500);
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.nav-link:hover {
    background: var(--slate-50);
    color: var(--slate-900);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* Collapsed Sidebar Styles */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-link span {
    display: none;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0.5rem;
}

.sidebar-collapsed .sidebar-nav {
    padding: 1rem 0.5rem;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
    font-size: 1.25rem;
}

.sidebar-collapsed .nav-link i {
    margin: 0;
}

/* Main Content Adjustments */
.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

@media (min-width: 1025px) {

    .sidebar,
    .main-content {
        transition: var(--transition);
    }
}


/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.topbar {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.page-container {
    padding: 1.5rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

/* Components */
.card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--slate-100);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--slate-200);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--slate-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Grid System */
.grid {
    display: grid;
    gap: 1.25rem;
}

.grid-cols-1 {
    grid-template-columns: 1fr;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 1024px) {
    .lg\:grid-cols-12 {
        grid-template-columns: repeat(12, 1fr);
    }

    .lg\:span-8 {
        grid-column: span 8;
    }

    .lg\:span-4 {
        grid-column: span 4;
    }
}

/* Responsive Grid Utilities */
@media (min-width: 768px) {
    .md\:grid-cols-1 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .md\:span-1 {
        grid-column: span 1 / span 1;
    }

    .md\:span-2 {
        grid-column: span 2 / span 2;
    }

    .md\:span-3 {
        grid-column: span 3 / span 3;
    }

    .md\:span-4 {
        grid-column: span 4 / span 4;
    }

    .md\:p-10 {
        padding: 2.5rem;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border-color: var(--slate-200);
    color: var(--slate-600);
}

.btn-secondary:hover {
    background: var(--slate-50);
    border-color: var(--slate-300);
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Form Controls - Sleeker */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--slate-500);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-100);
    border-radius: 0.5rem;
    color: var(--slate-800);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Vivid empty state styling for better interaction */
.form-control:placeholder-shown {
    background-color: var(--slate-100) !important;
    border: 2px solid var(--slate-300) !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Return to clean state when input has value */
.form-control:not(:placeholder-shown) {
    background-color: white;
    border-color: var(--slate-200);
}

/* Modals & Tooltips - IMPORTANT: Hidden by default */
.modal,
.fade {
    display: none;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(10px);
    opacity: 0;
    transition: var(--transition);
    position: relative;
}

.modal-overlay.show {
    display: flex;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--slate-50);
    margin-bottom: 1rem;
    padding-right: 2rem;
    /* Space for close button */
}

.modal-title {
    font-size: 1.125rem;
}

.modal-body {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--slate-600);
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--slate-100);
    border-radius: 10px;
}

.modal-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--slate-50);
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Enhanced Close Button */
.modal-content .close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #ef4444 !important;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.modal-content .close:hover {
    background: #fee2e2;
    transform: rotate(90deg);
}

body.modal-open {
    overflow: hidden !important;
}

/* Purple Accent for Tooltip Buttons */
.form-group .btn[data-toggle="modal"] {
    background-color: #f3e8ff !important;
    /* purple-100 */
    border-color: #d8b4fe !important;
    /* purple-300 */
    color: #9333ea !important;
    /* purple-600 */
}

.form-group .btn[data-toggle="modal"]:hover {
    background-color: #e9d5ff !important;
    /* purple-200 */
    color: #7e22ce !important;
    /* purple-700 */
}

.form-group .btn[data-toggle="modal"] i {
    color: inherit !important;
}



/* Alerts */
.alert {
    padding: 0.875rem 1.125rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    color: #166534;
}

.alert-info {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    color: #075985;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    color: #92400e;
}

/* Badges */
.badge {
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-info {
    background: #f0f9ff;
    color: #0ea5e9;
}

.badge-success {
    background: #f0fdf4;
    color: #22c55e;
}

/* Utilities */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.p-2 {
    padding: 0.5rem;
}

.hidden {
    display: none !important;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.font-bold {
    font-weight: 700;
}

.text-slate-400 {
    color: var(--slate-400);
}

.uppercase {
    text-transform: uppercase;
}

.tracking-widest {
    letter-spacing: 0.1em;
}

/* Custom Overlap Fixes */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* Progress Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0;
    margin: 2rem 0;
    list-style: none;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--slate-100);
    z-index: 1;
}

.step-item {
    position: relative;
    z-index: 2;
    flex: 1;
    text-align: center;
}

.step-icon {
    width: 48px;
    height: 48px;
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: var(--slate-400);
    transition: var(--transition);
}

.step-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.step-item.active .step-icon {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 4px white, 0 0 0 7px var(--primary-light);
}

.step-item.active .step-label {
    color: var(--primary);
}

.step-item.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-item.completed .step-label {
    color: var(--success);
}

.step-item.failed .step-icon {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.step-item.failed .step-label {
    color: var(--danger);
}

/* Mobile Stepper */
@media (max-width: 640px) {
    .stepper {
        flex-direction: column;
        gap: 2rem;
        align-items: flex-start;
        padding-left: 1rem;
    }

    .stepper::before {
        left: 33px;
        top: 24px;
        bottom: 24px;
        width: 2px;
        height: auto;
    }

    .step-item {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        text-align: left;
    }

    .step-icon {
        margin: 0;
    }

    .step-label {
        margin-bottom: 0;
    }
}

/* Animations */
@keyframes pulse-primary {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.animate-pulse-primary {
    animation: pulse-primary 2s infinite;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: slideUp 0.5s ease forwards;
}

/* Mobile Dashboard Layout */
@media (max-width: 1024px) {
    .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
    }

    .profile-card-col {
        order: -1;
    }

    .profile-card-col .card {
        position: static !important;
        margin-bottom: 1.5rem;
    }

    .hide-on-mobile {
        display: none !important;
    }
}

.text-success {
    color: var(--success) !important;
}

/* Validation Styling */
.form-control.is-invalid-field,
.neat-input.is-invalid-field {
    background-color: #fef2f2 !important;
    /* light red */
    border-color: #fecaca !important;
    /* red-200 */
    color: #991b1b !important;
    /* red-800 */
}

.form-control.is-invalid-field:focus,
.neat-input.is-invalid-field:focus {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.label-warning-icon {
    color: var(--danger);
    font-size: 0.85rem;
    margin-left: 0.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}