/* Fresh Cream — custom theme on top of Bootstrap 5 */

:root {
    --fc-navy:       #0f2540;
    --fc-navy-2:     #16324f;
    --fc-teal:       #0d9488;
    --fc-teal-dark:  #0b7c72;
    --fc-teal-soft:  #ccfbf1;
    --fc-bg:         #f1f5f9;
    --fc-card:       #ffffff;
    --fc-line:       #e2e8f0;
    --fc-text:       #0f172a;
    --fc-muted:      #64748b;
    --sidebar-w:     260px;
    --topbar-h:      64px;

    --bs-primary:    #0d9488;
    --bs-primary-rgb: 13, 148, 136;
}

/* -------------------------------------------------------------------------
   Base
   ---------------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--fc-bg);
    color: var(--fc-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* -------------------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: #0d9488;
    --bs-btn-border-color: #0d9488;
    --bs-btn-hover-bg: #0b7c72;
    --bs-btn-hover-border-color: #0b7c72;
    --bs-btn-active-bg: #0b7c72;
    --bs-btn-active-border-color: #0b7c72;
    --bs-btn-disabled-bg: #94a3b8;
    --bs-btn-disabled-border-color: #94a3b8;
    --bs-btn-focus-shadow-rgb: 13, 148, 136;
}
.btn-outline-primary {
    --bs-btn-color: #0d9488;
    --bs-btn-border-color: #0d9488;
    --bs-btn-hover-bg: #0d9488;
    --bs-btn-hover-border-color: #0d9488;
}

.btn-icon {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--fc-line);
    background: #fff;
    color: var(--fc-navy);
    border-radius: 10px;
    padding: 0;
}
.btn-icon:hover { background: #f8fafc; }

/* -------------------------------------------------------------------------
   App shell
   ---------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar ---------------------------------------------------------------- */
.app-sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--fc-navy);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform .22s ease;
}

.app-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    color: #fff;
}
.brand-mark {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--fc-teal), #06b6d4);
    border-radius: 10px;
    color: #fff;
    font-size: 1.15rem;
    flex: 0 0 auto;
}
.brand-logo {
    width: 38px; height: 38px; object-fit: cover;
    border-radius: 10px; background: #fff;
}
.brand-name {
    font-weight: 700;
    font-size: .98rem;
    letter-spacing: .01em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-nav {
    padding: 10px 8px 0;
    flex: 1 1 auto;
}
.app-nav .nav-section {
    color: #64748b;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 14px 12px 6px;
}
.app-nav .nav-link,
.app-sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .12s ease, color .12s ease;
}
.app-nav .nav-link i,
.app-sidebar-footer .nav-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex: 0 0 auto;
}
.app-nav .nav-link:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
}
.app-nav .nav-link.active {
    background: linear-gradient(90deg, var(--fc-teal), var(--fc-teal-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(13,148,136,.35);
}
.app-nav .nav-link.disabled {
    color: #64748b;
    cursor: not-allowed;
    opacity: .7;
}
.app-nav .nav-link.disabled:hover { background: transparent; }

.app-sidebar-footer {
    padding: 10px 8px 14px;
    border-top: 1px solid rgba(255,255,255,.07);
}
.app-sidebar-footer .nav-link.logout-link:hover {
    background: rgba(220,38,38,.15);
    color: #fecaca;
}

/* Main ---------------------------------------------------------------- */
.app-main {
    flex: 1 1 auto;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Topbar ------------------------------------------------------------- */
.app-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--fc-line);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky; top: 0;
    z-index: 1020;
}
.page-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fc-navy);
}

.btn-user {
    display: flex; align-items: center; gap: 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 5px 10px;
    color: var(--fc-text);
}
.btn-user:hover { background: #f8fafc; border-color: var(--fc-line); }
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--fc-teal), #06b6d4);
    color: #fff;
    font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .9rem;
}
.user-name { font-weight: 600; font-size: .85rem; line-height: 1.1; }
.user-role { font-size: .72rem; color: var(--fc-muted); line-height: 1.1; }

/* Content ------------------------------------------------------------ */
.app-content {
    flex: 1 1 auto;
    padding: 22px 22px 30px;
}

.app-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--fc-line);
    background: #fff;
    font-size: .8rem;
    color: var(--fc-muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* -------------------------------------------------------------------------
   Cards
   ---------------------------------------------------------------------- */
.card {
    border: 1px solid var(--fc-line);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--fc-line);
    font-weight: 600;
    border-top-left-radius: 14px !important;
    border-top-right-radius: 14px !important;
    padding: 14px 18px;
}
.card-body { padding: 18px; }

/* Stat cards --------------------------------------------------------- */
.stat-card {
    background: #fff;
    border: 1px solid var(--fc-line);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
    height: 100%;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex: 0 0 auto;
    background: var(--fc-teal-soft);
    color: var(--fc-teal-dark);
}
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.amber  { background: #fef3c7; color: #b45309; }
.stat-icon.rose   { background: #fee2e2; color: #b91c1c; }
.stat-icon.purple { background: #ede9fe; color: #6d28d9; }
.stat-icon.slate  { background: #e2e8f0; color: #334155; }

.stat-body { min-width: 0; }
.stat-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--fc-muted);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--fc-navy);
}
.stat-sub {
    font-size: .78rem;
    color: var(--fc-muted);
    margin-top: 2px;
}

/* -------------------------------------------------------------------------
   Tables & forms
   ---------------------------------------------------------------------- */
.table > :not(caption) > * > * { padding: .7rem .85rem; }
.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--fc-muted);
    font-weight: 700;
    background: #f8fafc;
    border-bottom: 1px solid var(--fc-line);
}
.table tbody tr:hover { background: #f8fafc; }

.form-label { font-weight: 600; font-size: .85rem; color: #334155; }
.form-control:focus,
.form-select:focus {
    border-color: var(--fc-teal);
    box-shadow: 0 0 0 .2rem rgba(13,148,136,.15);
}

/* -------------------------------------------------------------------------
   Login screen
   ---------------------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 10% -20%, rgba(13,148,136,.35), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(15,37,64,.55), transparent 60%),
        linear-gradient(135deg, #0f2540 0%, #0d9488 140%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 34px 32px 30px;
    box-shadow: 0 25px 60px rgba(15,23,42,.28);
}
.login-brand {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px;
}
.login-brand .brand-mark {
    width: 46px; height: 46px; font-size: 1.4rem;
}
.login-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--fc-navy); }
.login-sub   { margin: 2px 0 0; font-size: .82rem; color: var(--fc-muted); }

.login-card .form-control {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: .95rem;
}
.login-card .btn-primary {
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 600;
}
.login-foot {
    text-align: center;
    font-size: .78rem;
    color: var(--fc-muted);
    margin-top: 22px;
}

/* -------------------------------------------------------------------------
   Sidebar overlay (mobile)
   ---------------------------------------------------------------------- */
.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    opacity: 0; visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 1035;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }

/* -------------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 30px rgba(0,0,0,.25);
    }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-content { padding: 16px 14px 24px; }
    .app-topbar { padding: 0 14px; }
    .page-title { font-size: 1rem; }
}

@media (min-width: 992px) {
    #sidebarToggle { display: none; }
}