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

:root {
    --red:       #C52C17;
    --red-dark:  #8B1A0E;
    --red-light: #E04430;
    --red-soft:  #FDF1EF;
    --red-mid:   #FFD6D6;
    --white:     #FFFFFF;
    --gray-50:   #EFEFF2;
    --gray-100:  #D4D4DC;
    --gray-200:  #BEBEC8;
    --gray-300:  #A8A8B4;
    --gray-500:  #71717A;
    --gray-700:  #3F3F46;
    --gray-900:  #18181B;
    --sidebar-w: 240px;
    --radius:    10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow:    0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

body {
    font-family: 'Lexend', sans-serif;
    background: #B8BAC8;
    color: var(--gray-900);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
}

/* ─── LAYOUT ─── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 2px solid #C4C4CC;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid #D0D0D8;
    text-decoration: none;
}

.brand-icon {
    width: 36px; height: 36px;
    background: var(--red);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(214,40,40,0.3);
    flex-shrink: 0;
}

.brand-name {
    font-weight: 800;
    font-size: 15px;
    color: var(--gray-900);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10px;
    color: var(--gray-500);
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* ─── NAV ─── */
.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    overflow-y: auto;
}

/* Accordion group */
.nav-group { margin-bottom: 2px; }

.nav-group-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 7px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Lexend', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-align: left;
    transition: all 0.15s;
    position: relative;
}

.nav-group-btn:hover {
    background: #B8BAC8;
    color: var(--gray-900);
}

.nav-group-btn.open {
    color: var(--red);
    background: var(--red-soft);
}

.nav-group-icon { font-size: 14px; flex-shrink: 0; }

.nav-group-chevron {
    margin-left: auto;
    font-size: 10px;
    color: var(--gray-300);
    transition: transform 0.2s ease;
}

.nav-group-btn.open .nav-group-chevron {
    transform: rotate(180deg);
    color: var(--red);
}

/* Sub items */
.nav-sub {
    overflow: visible;
    max-height: none;
    padding-left: 8px;
}

.nav-sub.open { display: block; }
.nav-sub:not(.open) { display: none; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    color: var(--gray-600, #52525B);
    transition: all 0.15s ease;
    margin-bottom: 1px;
    position: relative;
}

.nav-link::before {
    content: '';
    display: block;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
    transition: background 0.15s;
}

.nav-link:hover {
    background: var(--red-soft);
    color: var(--red);
}

.nav-link:hover::before { background: var(--red-light); }

.nav-link.active {
    background: var(--red);
    color: var(--white);
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(214,40,40,0.2);
}

.nav-link.active::before { background: rgba(255,255,255,0.6); }

/* ─── SIDEBAR FOOTER ─── */
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 9px;
    overflow: hidden;
    min-width: 0;
}

.user-avatar {
    width: 30px; height: 30px;
    background: var(--red);
    color: white;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10.5px;
    color: var(--gray-500);
    font-weight: 400;
}

.logout-btn {
    font-size: 15px;
    color: var(--gray-400);
    text-decoration: none;
    padding: 5px;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.logout-btn:hover { background: var(--red-soft); color: var(--red); }

/* ─── MAIN CONTENT ─── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #B8BAC8;
}

/* ─── TOPBAR ─── */
.topbar {
    background: var(--white);
    border-bottom: 2px solid #C4C4CC;
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--gray-900);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-date {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 300;
}

.topbar-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid var(--red-mid);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
}

.live-dot {
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── PAGE BODY ─── */
.page-body {
    padding: 28px;
    flex: 1;
    background: #B8BAC8;
}

/* ─── STAT CARDS ─── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.13);
    transition: box-shadow 0.2s, transform 0.2s;
    animation: fadeUp 0.4s ease backwards;
}

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.red    { background: var(--red-soft); }
.stat-icon.pink   { background: #FFF0F8; }
.stat-icon.orange { background: #FFF5EE; }
.stat-icon.rose   { background: #FFF1F1; }

.stat-num {
    font-weight: 800;
    font-size: 26px;
    color: var(--gray-900);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
    font-weight: 400;
}

/* ─── CARDS ─── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.13);
    overflow: hidden;
    animation: fadeUp 0.4s ease 0.2s backwards;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid #D0D0D8;
}

.card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-900);
}

.card-body { padding: 20px 22px; }

/* ─── TABLE ─── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
    background: var(--gray-50);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid #C4C4CC;
}

.data-table td {
    padding: 12px 16px;
    font-size: 13.5px;
    border-bottom: 1px solid #D0D0D8;
    color: var(--gray-700);
    font-weight: 400;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ─── BADGES ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 500;
}

.badge-active  { background: #F0FFF4; color: #16A34A; border: 1px solid #BBF7D0; }
.badge-idle    { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.badge-off     { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-mid); }

/* Role badges */
.badge-role-admin    { background: #18181B; color: #fff;     border: 1px solid #3F3F46; }
.badge-role-mudur    { background: #FFF0F0; color: #D62828;  border: 1px solid #FFD6D6; }
.badge-role-yonetici { background: #EFF6FF; color: #1D4ED8;  border: 1px solid #BFDBFE; }
.badge-role-teknik   { background: #F0FDF4; color: #166534;  border: 1px solid #BBF7D0; }
.badge-role-kasiyer  { background: #FFF7ED; color: #C2410C;  border: 1px solid #FED7AA; }
.badge-role-operator { background: #FAF5FF; color: #7E22CE;  border: 1px solid #E9D5FF; }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    font-family: 'Lexend', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--red);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(214,40,40,0.25);
}
.btn-primary:hover { background: var(--red-dark); box-shadow: 0 4px 12px rgba(214,40,40,0.35); transform: translateY(-1px); }

.btn-outline {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-outline:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-family: 'Lexend', sans-serif;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(214,40,40,0.1);
}

.form-control::placeholder { color: var(--gray-300); }

.form-hint {
    font-size: 11.5px;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 300;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ─── ALERTS ─── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}
.alert-error   { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-mid); }
.alert-success { background: #F0FFF4; color: #16A34A; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── LOGIN PAGE ─── */
.login-page {
    min-height: 100vh;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 860px;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    animation: fadeUp 0.5s ease;
}

.login-left {
    background: var(--red);
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

.login-left::after {
    content: '';
    position: absolute;
    bottom: -40px; left: -40px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.login-brand { position: relative; z-index: 1; }

.login-brand-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.login-brand-name {
    font-weight: 800;
    font-size: 24px;
    color: white;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-brand-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    line-height: 1.7;
    font-weight: 300;
}

.login-features { position: relative; z-index: 1; }

.login-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 400;
}

.login-feature-dot {
    width: 5px; height: 5px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    flex-shrink: 0;
}

.login-right {
    padding: 50px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-title {
    font-weight: 800;
    font-size: 22px;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.login-sub {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 30px;
    font-weight: 300;
}

/* ─── MONITOR ─── */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.monitor-card {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.monitor-card.online  { border-color: #BBF7D0; }
.monitor-card.warning { border-color: #FDE68A; }
.monitor-card.offline { border-color: var(--red-mid); }
.monitor-card:hover   { box-shadow: var(--shadow); transform: translateY(-1px); }

.monitor-id {
    font-weight: 700;
    font-size: 13px;
    color: var(--gray-900);
}

.monitor-name { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; font-weight: 400; }

.monitor-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.online  .monitor-status-dot { background: #16A34A; box-shadow: 0 0 5px #16A34A; }
.warning .monitor-status-dot { background: #D97706; }
.offline .monitor-status-dot { background: var(--red); }

/* ─── SESSION TIMEOUT BAR ─── */
.timeout-bar {
    position: fixed;
    bottom: 0; left: var(--sidebar-w); right: 0;
    height: 3px;
    background: var(--gray-100);
    z-index: 200;
}

.timeout-bar-fill {
    height: 100%;
    background: var(--red);
    transition: width 1s linear;
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mb-20  { margin-bottom: 20px; }
.mt-20  { margin-top: 20px; }
