/* ============================================
   Saras WhiteScholars - Base Styles
   Global styles, sidebar, variables, utilities
   ============================================ */

/* ============================================
   Global scale: UI at 90% at 100% browser zoom
   (matches visual at 90% zoom without user change).
   Height compensation so scaled layout fills viewport (no gap at bottom).
   ============================================ */
html {
    zoom: 0.9;
    scroll-behavior: smooth;
}

/* Compensate viewport-based heights so that at 0.9 scale they fill the viewport (100/90 ≈ 111.11%). */
html .sidebar,
html .main-content {
    --scale-inverse: 1.111111; /* 1 / 0.9 */
}
html .sidebar {
    height: calc(100vh * var(--scale-inverse));
}
html .main-content {
    min-height: calc(100vh * var(--scale-inverse));
}

/* ============================================
   CSS Variables & Base Styles
   ============================================ */

:root {
    /* Color Palette */
    --primary-text: #1F2933;
    --page-bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --primary-accent: #C04A5A;
    --secondary-accent: #0F4C5C;
    --sidebar-bg: #1F2933;
    --border-color: #E5E7EB;
    --hover-bg: #F3F4F6;
    --text-muted: #6B7280;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
}

/* Typography - Poppins Font */
* {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--page-bg);
    color: var(--primary-text);
    font-weight: 400;
    line-height: 1.6;
    font-size: 0.9rem;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-text);
    font-weight: 600;
    margin-bottom: 1rem;
}

h1 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.95rem; }

/* ============================================
   Sidebar Styles
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 75px;
    background: var(--sidebar-bg);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar:hover,
.sidebar.expanded {
    width: 250px;
}

.sidebar-header {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    transition: padding 0.3s ease;
}

.sidebar:hover .sidebar-header,
.sidebar.expanded .sidebar-header {
    padding: 0.625rem 1.5rem;
}

.sidebar-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    gap: 0.4rem;
}

.sidebar-logo-icon {
    height: 42px;
    width: auto;
    flex-shrink: 0;
    object-fit: contain;
    display: block;
    transition: all 0.3s ease;
    opacity: 0.95;
}

.sidebar:hover .sidebar-logo-icon,
.sidebar.expanded .sidebar-logo-icon {
    opacity: 1;
}

.sidebar-logo-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, width 0.3s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-logo-text,
.sidebar.expanded .sidebar-logo-text {
    opacity: 1;
    width: auto;
}

.sidebar-header h4 {
    margin: 0;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.sidebar-header h4 i {
    color: var(--primary-accent);
    margin-right: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0 1rem 0;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.9375rem 1rem;
    transition: all 0.2s ease, padding 0.3s ease;
    border-left: 3px solid transparent;
    font-weight: 400;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    line-height: 1.5;
    white-space: nowrap;
    justify-content: flex-start;
}

.sidebar:hover .sidebar-nav .nav-link,
.sidebar.expanded .sidebar-nav .nav-link {
    padding: 0.9375rem 1.5rem;
}

.sidebar-nav .nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, width 0.3s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-nav .nav-link span,
.sidebar.expanded .sidebar-nav .nav-link span {
    opacity: 1;
    width: auto;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: var(--secondary-accent);
}

.sidebar-nav .nav-link.active {
    background: rgba(192, 74, 90, 0.15);
    color: white;
    border-left-color: var(--primary-accent);
    font-weight: 500;
}

.sidebar-nav .nav-link.active i {
    color: var(--primary-accent);
}

.sidebar-nav .nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.125rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: padding 0.3s ease;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.sidebar:hover .sidebar-footer,
.sidebar.expanded .sidebar-footer {
    padding: 1.5rem;
    align-items: stretch;
}

.user-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: justify-content 0.3s ease;
    min-height: 48px;
}

.sidebar:hover .user-info,
.sidebar.expanded .user-info {
    justify-content: flex-start;
}

.user-info i {
    font-size: 1.5rem;
    margin-right: 0;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    transition: margin-right 0.3s ease;
}

.sidebar:hover .user-info i,
.sidebar.expanded .user-info i {
    margin-right: 0.5rem;
}

.user-info .user-info-text-wrapper {
    display: none;
    flex-direction: column;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar:hover .user-info .user-info-text-wrapper,
.sidebar.expanded .user-info .user-info-text-wrapper {
    display: flex;
    opacity: 1;
    width: auto;
}

.user-info .user-info-text-wrapper > span {
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: block;
    color: rgba(255, 255, 255, 0.95);
}

.user-info .user-info-text-wrapper small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    display: block;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background-color: var(--page-bg);
}

.main-content.with-sidebar {
    margin-left: 75px;
    transition: margin-left 0.3s ease;
}

.sidebar:hover ~ .main-content.with-sidebar,
.sidebar.expanded ~ .main-content.with-sidebar {
    margin-left: 250px;
}

.main-content .container-fluid {
    padding: 2rem;
    animation: pageFadeIn 0.5s ease-out;
}

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

/* ============================================
   Page Headers
   ============================================ */

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.5s ease-out 0.1s both;
}

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

h2 i {
    color: var(--secondary-accent);
    margin-right: 0.5rem;
}

/* ============================================
   Cards (Base)
   ============================================ */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    animation: cardFadeIn 0.5s ease-out both;
}

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

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    color: var(--primary-text);
    border-radius: 12px 12px 0 0 !important;
    animation: fadeIn 0.4s ease-out 0.2s both;
    font-size: 0.95rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    border: none;
}

.btn i {
    margin-right: 0.375rem;
}

/* Primary Button */
.btn-primary {
    background-color: var(--primary-accent);
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #B83A4A;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(192, 74, 90, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-outline-primary {
    border: 1.5px solid var(--secondary-accent);
    color: var(--secondary-accent);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--secondary-accent);
    color: white;
    border-color: var(--secondary-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(15, 76, 92, 0.2);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    background: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--hover-bg);
    color: var(--primary-text);
    border-color: var(--border-color);
}

/* Danger Button */
.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.btn-outline-danger {
    border: 1.5px solid var(--danger);
    color: var(--danger);
    background: transparent;
}

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

.sidebar-logout-btn {
    width: auto;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    margin: 0 auto;
    border-radius: 6px;
}

.sidebar:hover .sidebar-logout-btn,
.sidebar.expanded .sidebar-logout-btn {
    justify-content: center;
    width: auto;
    min-width: auto;
    padding: 0.5rem 1rem;
}

.sidebar-logout-btn i {
    margin-right: 0;
    flex-shrink: 0;
    transition: margin-right 0.3s ease;
}

.sidebar:hover .sidebar-logout-btn i,
.sidebar.expanded .sidebar-logout-btn i {
    margin-right: 0.375rem;
}

.sidebar-logout-btn span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, width 0.3s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-logout-btn span,
.sidebar.expanded .sidebar-logout-btn span {
    opacity: 1;
    width: auto;
}

/* Small Buttons */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ============================================
   Forms
   ============================================ */

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary-text);
    font-size: 0.875rem;
}

.form-control,
.form-select {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: var(--card-bg);
    color: var(--primary-text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--secondary-accent);
    box-shadow: 0 0 0 3px rgba(15, 76, 92, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* ============================================
   Badges
   ============================================ */

.badge {
    padding: 0.5em 0.875em;
    font-weight: 500;
    border-radius: 6px;
    font-size: 0.85rem;
    animation: badgePop 0.3s ease-out both;
    animation-delay: 0.4s;
    transition: transform 0.2s ease;
}

@keyframes badgePop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.badge:hover {
    transform: scale(1.1);
}

.badge.bg-secondary {
    background-color: #9CA3AF !important;
    color: white;
}

.badge.bg-info {
    background-color: var(--secondary-accent) !important;
    color: white;
}

.badge.bg-primary {
    background-color: var(--primary-accent) !important;
    color: white;
}

.badge.bg-warning {
    background-color: var(--warning) !important;
    color: white;
}

.badge.bg-success {
    background-color: var(--success) !important;
    color: white;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
    color: white;
}

/* ============================================
   Flash Messages
   ============================================ */

.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    min-width: 300px;
    max-width: 500px;
}

.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
    font-weight: 400;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background-color: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--danger);
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid var(--info);
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning);
}

/* ============================================
   Modals
   ============================================ */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
    color: var(--primary-text);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.logout-modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    background: var(--card-bg);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.logout-icon-wrapper {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-accent) 0%, #B83A4A 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    box-shadow: 0 8px 16px rgba(192, 74, 90, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: iconPulse 0.6s ease-out 0.2s both;
}

@keyframes iconPulse {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.logout-icon-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(192, 74, 90, 0.35);
}

.logout-modal-content .modal-body {
    padding: 2.5rem 2rem;
    color: var(--primary-text);
}

.logout-modal-content h5 {
    color: var(--primary-text);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2rem;
    font-family: 'Poppins', sans-serif;
    animation: fadeInUp 0.4s ease-out 0.3s both;
}

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

.logout-modal-content .d-flex.gap-2 {
    gap: 0.75rem !important;
    animation: fadeInUp 0.4s ease-out 0.4s both;
}

.logout-modal-content .btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.75rem 1.75rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    min-width: 100px;
}

.logout-modal-content .btn-outline-secondary {
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    background: var(--card-bg);
}

.logout-modal-content .btn-outline-secondary:hover {
    background-color: var(--hover-bg);
    color: var(--primary-text);
    border-color: var(--border-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.logout-modal-content .btn-danger {
    background-color: var(--primary-accent);
    color: white;
    border: none;
}

.logout-modal-content .btn-danger:hover {
    background-color: #B83A4A;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 74, 90, 0.35);
}

.modal-backdrop {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background-color: rgba(31, 41, 51, 0.4) !important;
    animation: backdropFadeIn 0.2s ease-out;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.text-muted {
    color: var(--text-muted) !important;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content.with-sidebar {
        margin-left: 0;
    }

    .main-content .container-fluid {
        padding: 1rem;
    }

    .flash-messages {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
}

/* ============================================
   Additional Polish
   ============================================ */

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--secondary-accent);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background-color: rgba(192, 74, 90, 0.2);
    color: var(--primary-text);
}

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Empty state styling */
.text-center.py-5 {
    color: var(--text-muted);
    animation: fadeIn 0.5s ease-out 0.3s both;
}

.text-center.py-5 i {
    opacity: 0.5;
}

/* Page header spacing */
.d-flex.justify-content-between.align-items-center.mb-4 {
    margin-bottom: 2rem !important;
}

/* Card header icons */
.card-header i {
    color: var(--secondary-accent);
    margin-right: 0.5rem;
}

/* Table responsive improvements */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

/* Table font sizes */
.table {
    font-size: 0.875rem;
}

.table tbody td {
    font-size: 0.875rem;
}

/* Form improvements */
.invalid-feedback {
    font-size: 0.875rem;
    color: var(--danger);
}

/* Link styling */
a {
    color: var(--primary-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #B83A4A;
}

/* Icon improvements */
i.bi {
    vertical-align: middle;
}

