/* ==========================================================================
   Insan Degree College ERP — Design System & Master Stylesheet
   ========================================================================== */

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

:root {
    --primary-navy: #0B1F3A;
    --royal-blue: #123E78;
    --brand-blue: #1D5FA7;
    --brand-blue-hover: #174d89;
    --accent-gold: #C9A227;
    --soft-gold: #E5C65A;
    --off-white: #F8F7F2;
    --surface-white: #FFFFFF;
    --text-primary: #172033;
    --text-secondary: #475569;
    --text-muted: #667085;
    --border-light: #E2E8F0;
    --border-subtle: rgba(148, 163, 184, 0.25);
    --bg-page: #F3F4F6;
    --status-success: #2E7D5B;
    --status-warning: #D97706;
    --status-danger: #DC2626;
    --status-info: #0284C7;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Layout Architecture
   ========================================================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-navy);
    color: #E2E8F0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #08172c;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.2px;
}

.sidebar-logo .brand-badge {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.sidebar-logo .brand-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

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

.nav-section-title {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748B;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 1.25rem;
    color: #94A3B8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: #FFFFFF;
    background-color: rgba(29, 95, 167, 0.25);
    border-left-color: var(--accent-gold);
    font-weight: 600;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
}

.main-container {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem;
}

.topbar-search {
    position: relative;
    width: 280px;
}

.topbar-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: #F1F5F9;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s ease;
}

.topbar-search input:focus {
    background: #FFFFFF;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(29, 95, 167, 0.15);
}

.topbar-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: #94A3B8;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--royal-blue);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    border: 2px solid var(--accent-gold);
}

.user-info {
    line-height: 1.2;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* ==========================================================================
   Page Content Area
   ========================================================================== */

.page-content {
    padding: 1.75rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--primary-navy);
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.page-breadcrumb a {
    color: var(--brand-blue);
    text-decoration: none;
}

.page-breadcrumb a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Cards & KPI Panels
   ========================================================================== */

.card {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-navy);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--royal-blue);
}

.kpi-card.gold::before { background: var(--accent-gold); }
.kpi-card.green::before { background: var(--status-success); }
.kpi-card.red::before { background: var(--status-danger); }
.kpi-card.blue::before { background: var(--brand-blue); }

.kpi-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-navy);
    line-height: 1;
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.kpi-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: #EFF6FF;
    color: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Buttons & Form Controls
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.btn-primary {
    background: var(--royal-blue);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--primary-navy);
}

.btn-gold {
    background: var(--accent-gold);
    color: var(--primary-navy);
    font-weight: 600;
}

.btn-gold:hover {
    background: var(--soft-gold);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: #F8FAFC;
    color: var(--text-primary);
}

.btn-danger {
    background: var(--status-danger);
    color: #FFFFFF;
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.form-label .req {
    color: var(--status-danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(29, 95, 167, 0.15);
}

.form-error {
    font-size: 0.75rem;
    color: var(--status-danger);
    margin-top: 0.35rem;
}

/* ==========================================================================
   Tables & Badges
   ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.table th {
    background: #F8FAFC;
    color: #475569;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-light);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #F8FAFC;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success { background: #DEF7EC; color: #03543F; }
.badge-danger  { background: #FDE8E8; color: #9B1C1C; }
.badge-warning { background: #FEF08A; color: #713F12; }
.badge-info    { background: #E1EFFE; color: #1E429F; }
.badge-neutral { background: #F3F4F6; color: #374151; }

/* Alerts */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success { background: #DEF7EC; color: #03543F; border-left: 4px solid var(--status-success); }
.alert-danger  { background: #FDE8E8; color: #9B1C1C; border-left: 4px solid var(--status-danger); }
.alert-warning { background: #FEF08A; color: #713F12; border-left: 4px solid var(--status-warning); }

/* ==========================================================================
   Auth Layout (Login Page)
   ========================================================================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #123E78, #0B1F3A);
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 2rem;
}

.auth-card-header {
    background: var(--primary-navy);
    padding: 2rem;
    text-align: center;
    color: #FFFFFF;
    border-bottom: 3px solid var(--accent-gold);
}

.auth-card-body {
    padding: 2rem;
}

.auth-footer-container {
    width: 100%;
    max-width: 600px;
}

/* ==========================================================================
   MANDATORY STANDARDIZED FOOTER (CodeX404 Solutions)
   From DEVELOPMENT_PROMPT.md Specifications
   ========================================================================== */

/* Center-Aligned Footer Bottom */
.footer-bottom {
    padding: 18px 0 22px;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    text-align: center;
    color: #9FB3CE;
    font-size: 14px;
    background: #08172c;
    width: 100%;
}

/* Single-Line Centered Content */
.footer-bottom-line {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    line-height: 1.6;
}

/* Divider Dot (•) */
.footer-bottom-divider {
    color: rgba(148, 163, 184, 0.45);
    font-size: 0.85rem;
    user-select: none;
}

.footer-bottom strong {
    color: #F1F5F9;
}

.footer-dev-credit {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Developer Logo Container */
.dev-logo-link {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    text-decoration: none;
}

/* Developer Logo & Hover Animation */
.dev-logo {
    width: auto;
    height: 22px;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease;
}

.dev-logo-link:hover .dev-logo {
    transform: translateY(-2px) scale(1.15);
    filter: drop-shadow(0 4px 10px rgba(96, 165, 250, 0.55));
}

/* Mobile: Graceful Stack for Narrow Screens (<640px) */
@media (max-width: 640px) {
    .footer-bottom-line {
        flex-direction: column;
        gap: 0.35rem;
    }
    .footer-bottom-divider {
        display: none;
    }
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-container {
        margin-left: 0;
        width: 100%;
    }
    .sidebar-toggle-btn {
        display: block;
    }
}
