/* ============================================================
   AM Dashboard – Custom Styles
   ============================================================ */

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

:root {
    --sidebar-w:   230px;
    --topbar-h:    56px;
    --accent:      #1565ff;
    --accent-dark: #0d4ed8;
    --accent-light:#e8efff;
    --bg:          #f4f6fb;
    --sidebar-bg:  #1b2354;
    --sidebar-bg2: #161d47;
    --card-radius: 12px;
    --shadow-sm:   0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
}

/* ---- Base ------------------------------------------------- */
* { box-sizing: border-box; }

body {
    font-family: 'Noto Sans KR', -apple-system, sans-serif;
    font-size: 0.875rem;
    background-color: var(--bg);
    color: #1e293b;
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.25rem;
    height: var(--topbar-h);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    flex-shrink: 0;
}
.sidebar-brand:hover { color: #fff; }

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}
.sidebar-brand .brand-text span {
    display: block;
    white-space: nowrap;
}
.sidebar-brand .brand-text span:last-child {
    text-align: justify;
    text-align-last: justify;
}

.sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 1rem 1.25rem 0.35rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-item { margin: 0.1rem 0.75rem; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    color: rgba(255,255,255,0.58);
    font-size: 0.845rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.sidebar-nav .nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}
.sidebar-nav .nav-link.active {
    background: var(--accent);
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(21,101,255,0.35);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info .user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    line-height: 1.2;
}
.sidebar-user-info .user-role {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
}

.sidebar-logout {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.15s;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.8); }

/* ---- Topbar ----------------------------------------------- */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e8edf5;
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    z-index: 99;
    gap: 1rem;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-date {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
}

.topbar-user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
}

/* ---- Main wrapper ----------------------------------------- */
.main-wrapper {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
}

.main-content {
    padding: 1.75rem;
}

/* ---- Page header ------------------------------------------ */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.page-header .page-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

/* ---- Cards ------------------------------------------------ */
.card {
    border: 1px solid #eef0f6 !important;
    border-radius: var(--card-radius) !important;
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.card-header {
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
    font-size: 0.875rem;
    font-weight: 600;
    border-bottom: 1px solid #eef0f6 !important;
    background: #fff !important;
    padding: 1rem 1.25rem;
    color: #1e293b;
}

/* Stat cards */
.stat-card {
    border: 1px solid #eef0f6 !important;
    border-radius: var(--card-radius) !important;
    background: #fff;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
}

.stat-card-blue::before  { background: var(--accent); }
.stat-card-green::before { background: #10b981; }
.stat-card-red::before   { background: #ef4444; }
.stat-card-cyan::before  { background: #06b6d4; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.85rem;
}

.stat-icon-blue  { background: #eff4ff; }
.stat-icon-green { background: #ecfdf5; }
.stat-icon-red   { background: #fff1f2; }
.stat-icon-cyan  { background: #ecfeff; }

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1e293b;
}

.stat-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

/* Menu (shortcut) cards */
.menu-card {
    border: 1px solid #eef0f6 !important;
    border-radius: var(--card-radius) !important;
    background: #fff;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    cursor: pointer;
}
.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md) !important;
    border-color: var(--accent-light) !important;
}

.menu-card-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 0.85rem;
}

/* ---- Tables ----------------------------------------------- */
.table th {
    font-size: 0.775rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: middle;
    white-space: nowrap;
    color: #64748b;
    background: #f8fafc;
    border-top: none;
}
.table td {
    vertical-align: middle;
    white-space: nowrap;
    font-size: 0.845rem;
    color: #334155;
}

.table-hover > tbody > tr:hover > td {
    background-color: #f8f9ff;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.font-monospace {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
}

/* ---- Badges ----------------------------------------------- */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.3em 0.7em;
    border-radius: 6px;
}

/* ---- Nav tabs --------------------------------------------- */
.nav-tabs {
    border-bottom: 2px solid #e8edf5;
    gap: 0.25rem;
}
.nav-tabs .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.65rem 1.1rem;
    margin-bottom: -2px;
    transition: color 0.15s;
}
.nav-tabs .nav-link:hover { color: var(--accent); }
.nav-tabs .nav-link.active {
    color: var(--accent);
    font-weight: 700;
    background: transparent;
    border-bottom: 2px solid var(--accent);
}

/* ---- Buttons --------------------------------------------- */
.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
    border-radius: 8px;
}
.btn-primary:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
}
.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
    border-radius: 8px;
    font-weight: 600;
}
.btn-outline-primary:hover {
    background-color: var(--accent);
    border-color: var(--accent);
}
.btn { border-radius: 8px; }

/* ---- Form controls --------------------------------------- */
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(21,101,255,0.15);
}

/* ---- Login ----------------------------------------------- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(145deg, #071232 0%, #0d1b45 40%, #0f2260 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(21,101,255,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(21,101,255,0.08) 0%, transparent 40%);
    pointer-events: none;
}

.login-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}

.login-card {
    background: rgba(255,255,255,0.97);
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4) !important;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #0d1b45 0%, var(--accent) 100%);
    padding: 2rem 2rem 1.75rem;
    text-align: center;
    color: white;
}

.login-logo {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 1rem;
    backdrop-filter: blur(4px);
}

.login-header h4 { font-weight: 700; margin-bottom: 0.2rem; font-size: 1.25rem; }
.login-header small { opacity: 0.75; font-size: 0.82rem; }

.login-body {
    padding: 2rem;
}

.login-body .form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 0.4rem;
}

.login-body .form-control {
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    padding: 0.6rem 0.875rem;
    font-size: 0.9rem;
    background: #f8fafc;
    transition: border-color 0.15s, background 0.15s;
}
.login-body .form-control:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21,101,255,0.12);
}

.login-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #0d4ed8 100%);
    border: none;
    border-radius: 9px;
    padding: 0.7rem;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: opacity 0.15s, transform 0.1s;
}
.login-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* ---- Alerts ----------------------------------------------- */
.alert { border: none; border-radius: 10px; font-size: 0.845rem; }

/* ---- Divider --------------------------------------------- */
.section-divider {
    height: 1px;
    background: #e8edf5;
    margin: 1.5rem 0;
}

/* ---- Responsive ------------------------------------------- */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .topbar { left: 0; }
    .main-content { padding: 1rem; }
}
