/* ======================================================================
   custom.css  —  JWT Auth layout + Login page styles for ESimSol V2.1
   Breakpoints: mobile ≤767px | tablet 768–1024px | desktop ≥1025px
   ====================================================================== */

/* ── CSS Variables ──────────────────────────────────────────────── */
:root {
    --primary:        #CFB53B;
    --primary-dark:   #a88f2a;
    --primary-light:  #f0e080;
    --sidebar-width:  240px;
    --navbar-height:  60px;
    --transition:     0.25s ease;
    --sidebar-bg:     #1e2a3a;
    --sidebar-text:   #c8d6e5;
    --sidebar-hover:  #243447;
    --sidebar-active: #CFB53B;
    --body-bg:        #f4f6f9;
    --card-radius:    10px;
    --shadow-sm:      0 2px 8px rgba(0,0,0,.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,.12);
}

/* ── Base reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; }

/* ====================================================================
   LOGIN PAGE
   ==================================================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--card-radius);
    padding: 2.5rem 2rem 2rem;
    box-shadow: var(--shadow-md);
    animation: fadeSlideUp .35s ease both;
}

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

.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-logo {
    height: 64px;
    margin-bottom: .75rem;
    width: 100%; /* keep aspect ratio */
    max-width: 100%; /* prevent overflow */
    object-fit: contain; /* ensure full logo is visible */
    display: block;
}
.login-title  { font-size: 1.4rem; font-weight: 700; color: #1e2a3a; margin: 0; }
.login-subtitle { font-size: .875rem; margin-top: .25rem; }

.btn-login {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary-dark);
    padding: 5px 1rem;
    border-radius: 6px;
    transition: background var(--transition), box-shadow var(--transition);
}
.btn-login:hover  { background: var(--primary-dark); color: #fff; }
.btn-login:focus  { box-shadow: 0 0 0 .25rem rgba(207,181,59,.4); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; }

/* ====================================================================
   AUTHENTICATED LAYOUT — navbar
   ==================================================================== */

.auth-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: #fff;
    border-bottom: 1px solid #e4e8ed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.navbar-left  { display: flex; align-items: center; gap: .75rem; }
.navbar-right { display: flex; align-items: center; gap: 1rem; }

.brand-link {
    display: flex; align-items: center;
    text-decoration: none;
    color: #1e2a3a;
    font-weight: 700;
    font-size: 1.1rem;
}
.brand-link:hover { color: var(--primary); }
.brand-name { white-space: nowrap; }

.sidebar-toggle-btn {
    background: none;
    border: none;
    padding: .4rem .6rem;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
    font-size: 1.15rem;
    transition: background var(--transition);
}
.sidebar-toggle-btn:hover { background: #f0f2f5; color: var(--primary); }

.nav-icon {
    position: relative;
    cursor: pointer;
    color: #666;
    font-size: 1.1rem;
    padding: .3rem;
}
.nav-icon:hover { color: var(--primary); }

.badge-dot {
    position: absolute;
    top: 2px; right: 2px;
    width: 8px; height: 8px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ── User dropdown ───────────────────────────────────────────────── */

.user-dropdown { position: relative; }

.user-avatar {
    display: flex; align-items: center;
    cursor: pointer;
    padding: .35rem .6rem;
    border-radius: 6px;
    color: #333;
    font-size: .9rem;
    transition: background var(--transition);
}
.user-avatar:hover { background: #f0f2f5; }

.dropdown-menu-custom {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 8px);
    min-width: 220px;
    background: #fff;
    border: 1px solid #e4e8ed;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1040;
    overflow: hidden;
    animation: fadeSlideUp .2s ease both;
}
.dropdown-menu-custom.open { display: block; }

.dropdown-header {
    padding: .85rem 1rem;
    background: #f8f9fb;
}
.dropdown-divider { margin: 0; border-color: #e4e8ed; }

.dropdown-item-custom {
    display: flex; align-items: center;
    padding: .6rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: .9rem;
    transition: background var(--transition);
}
.dropdown-item-custom:hover { background: #f4f6f9; }
.dropdown-item-custom.text-danger { color: #dc3545 !important; }

/* ====================================================================
   AUTHENTICATED LAYOUT — sidebar
   ==================================================================== */

.auth-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1020;
    transition: transform var(--transition), width var(--transition);
    scrollbar-width: thin;
    scrollbar-color: #2c3e55 var(--sidebar-bg);
}

.auth-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--body-bg);
    transition: margin-left var(--transition);
}

/* Sidebar collapsed (toggled) */
.auth-sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
.auth-main.collapsed    { margin-left: 0; }

/* ── Sidebar navigation ──────────────────────────────────────────── */

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

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-item { margin: .1rem 0; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    white-space: nowrap;
}
.sidebar-link i { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sidebar-hover); color: var(--sidebar-active); border-left-color: var(--sidebar-active); font-weight: 600; }
.sidebar-link.text-danger-muted { color: #e87878; }
.sidebar-link.text-danger-muted:hover { color: #ff6b6b; background: rgba(220,53,69,.1); }

.sidebar-separator { height: 1px; background: #2c3e55; margin: .5rem 1rem; }

/* ── Sidebar overlay (mobile) ────────────────────────────────────── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1010;
}
.sidebar-overlay.show { display: block; }

/* ====================================================================
   AUTHENTICATED LAYOUT — main content
   ==================================================================== */

.auth-breadcrumb {
    padding: .6rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e4e8ed;
    font-size: .85rem;
}
.auth-breadcrumb .breadcrumb { margin: 0; }
.auth-breadcrumb a { color: var(--primary); text-decoration: none; }
.auth-breadcrumb a:hover { text-decoration: underline; }

.auth-content {
    padding: 1.5rem;
}

/* ====================================================================
   DASHBOARD COMPONENTS
   ==================================================================== */

/* Welcome card */
.welcome-card {
    background: linear-gradient(135deg, #1e2a3a 0%, #2c3e55 100%);
    color: #fff;
    border-radius: var(--card-radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

/* Stat cards */
.stat-card {
    border-radius: var(--card-radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    color: #fff;
}
.stat-icon { font-size: 2rem; opacity: .9; }
.stat-label { font-size: .78rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.stat-primary { background: linear-gradient(135deg, #2196f3, #1565c0); }
.stat-success { background: linear-gradient(135deg, #43a047, #1b5e20); }
.stat-warning { background: linear-gradient(135deg, #f9a825, #e65100); }
.stat-info    { background: linear-gradient(135deg, #00acc1, #006064); }

/* Token display */
.token-textarea {
    font-size: .75rem;
    resize: none;
    background: #f8f9fb;
    border-color: #dee2e6;
    word-break: break-all;
}
.token-payload {
    font-family: 'Courier New', monospace;
    font-size: .78rem;
    background: #f8f9fb;
    border-radius: 6px;
    padding: .75rem 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 8rem;
    color: #2c3e55;
}

/* Role badge */
.role-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 50px;
    background: var(--primary);
    color: #fff;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* ====================================================================
   TOAST NOTIFICATIONS
   ==================================================================== */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    pointer-events: none;
}

.ics-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    border-radius: 8px;
    padding: .75rem 1rem;
    box-shadow: var(--shadow-md);
    font-size: .9rem;
    min-width: 240px;
    max-width: 360px;
    animation: fadeSlideUp .25s ease both;
    border-left: 4px solid #ccc;
}
.ics-toast-success { border-left-color: #43a047; }
.ics-toast-error   { border-left-color: #e53935; }
.ics-toast-warning { border-left-color: #f9a825; }
.ics-toast-info    { border-left-color: #1e88e5; }

.toast-close-btn {
    background: none; border: none;
    margin-left: auto; padding: 0 .2rem;
    cursor: pointer; color: #999; font-size: .8rem;
}
.toast-close-btn:hover { color: #555; }

/* ====================================================================
   LOADING OVERLAY
   ==================================================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */

/* Tablet 768–1024 */
@media (max-width: 1024px) {
    :root { --sidebar-width: 200px; }
}

/* Mobile ≤767 */
@media (max-width: 767px) {
    .auth-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .auth-sidebar.collapsed {
        /* On mobile "collapsed" actually means OPEN (hamburger reveals it) */
        transform: translateX(0);
    }
    .auth-main {
        margin-left: 0 !important;
    }

    .brand-name { display: none; }

    .auth-content { padding: 1rem; }

    .welcome-card { padding: 1rem 1.25rem; }
    .welcome-card .fa-4x { font-size: 2.5rem; }
    .welcome-card h3 { font-size: 1.1rem; }

    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.05rem; }

    .user-display-name { display: none; }

    .login-card { padding: 1.75rem 1.25rem 1.5rem; }
}
