/* =============================================================================
   A2B Tunnel Admin Dashboard — Metronic Benzeri Tasarım
   Faz 10 — Dark sidebar, card-based layout, Inter font
   ============================================================================= */

:root {
    --sidebar-bg: #1e1e2d;
    --sidebar-hover: #2a2a3d;
    --sidebar-active: #3699ff;
    --sidebar-text: #9899ac;
    --sidebar-width: 260px;
    --header-bg: #ffffff;
    --content-bg: #f5f8fa;
    --card-bg: #ffffff;
    --primary: #3699ff;
    --info: #8950fc;
    --success: #1bc5bd;
    --warning: #ffa800;
    --danger: #f64e60;
    --text-main: #181c32;
    --text-muted: #b5b5c3;
    --border-color: #ebedf3;
    --shadow-sm: 0 0.1rem 1rem 0.25rem rgba(0, 0, 0, 0.04);
    --shadow-md: 0 0.5rem 1.5rem 0.5rem rgba(0, 0, 0, 0.06);
    --radius: 0.65rem;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--content-bg);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
}

/* =============================================================================
   Layout
   ============================================================================= */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(54, 153, 255, 0.1);
    color: var(--sidebar-active);
}

.sidebar-nav .nav-link.active i {
    color: var(--sidebar-active);
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
}

.sidebar-footer .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--danger);
}

/* Main content */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background: var(--header-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.admin-content {
    padding: 2rem;
    flex: 1;
}

/* =============================================================================
   Stat Cards
   ============================================================================= */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-primary .stat-icon {
    background: rgba(54, 153, 255, 0.1);
    color: var(--primary);
}

.stat-info .stat-icon {
    background: rgba(137, 80, 252, 0.1);
    color: var(--info);
}

.stat-success .stat-icon {
    background: rgba(27, 197, 189, 0.1);
    color: var(--success);
}

.stat-warning .stat-icon {
    background: rgba(255, 168, 0, 0.1);
    color: var(--warning);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.2rem;
}

/* =============================================================================
   Cards
   ============================================================================= */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.admin-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.admin-card .card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.admin-card .card-body {
    padding: 1.5rem;
}

/* =============================================================================
   Tables
   ============================================================================= */
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    padding: 0.85rem 1rem;
}

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

.table-hover tbody tr:hover {
    background: rgba(54, 153, 255, 0.03);
}

/* =============================================================================
   Login Page
   ============================================================================= */
.login-page {
    background: linear-gradient(135deg, #1e1e2d 0%, #0a0a1a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .brand-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 0.75rem;
    border-radius: 12px;
}

.login-brand h2 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.btn-login {
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.login-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
    font-weight: 500;
    font-size: 0.78rem;
    padding: 0.35em 0.65em;
    border-radius: 0.35rem;
}

/* =============================================================================
   Forms
   ============================================================================= */
.form-control,
.form-select {
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    padding: 0.6rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.15);
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: #1a80e6;
    border-color: #1a80e6;
    box-shadow: 0 3px 8px rgba(54, 153, 255, 0.35);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

/* =============================================================================
   Progress bars
   ============================================================================= */
.progress {
    border-radius: 1rem;
    background: var(--border-color);
}

/* =============================================================================
   Sidebar Toggle (Mobile)
   ============================================================================= */
.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0;
    margin-right: 1rem;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1025;
    display: none;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-content {
        padding: 1rem;
    }

    .admin-header {
        padding: 0.75rem 1rem;
    }
}

/* =============================================================================
   Animations
   ============================================================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.admin-card {
    animation: fadeIn 0.3s ease-out;
}

/* =============================================================================
   SSE Connection Status Indicator
   ============================================================================= */
.sse-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: var(--transition);
}

.sse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.sse-connected {
    background: rgba(27, 197, 189, 0.12);
    color: #0d9488;
}

.sse-connected .sse-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(27, 197, 189, 0.25);
    animation: pulse-green 2s infinite;
}

.sse-disconnected {
    background: rgba(246, 78, 96, 0.12);
    color: var(--danger);
}

.sse-disconnected .sse-dot {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(246, 78, 96, 0.25);
}

.sse-connecting {
    background: rgba(255, 168, 0, 0.12);
    color: #b45309;
}

.sse-connecting .sse-dot {
    background: var(--warning);
    box-shadow: 0 0 0 3px rgba(255, 168, 0, 0.25);
    animation: pulse-orange 1.2s infinite;
}

@keyframes pulse-green {

    0%,
    100% {
        box-shadow: 0 0 0 2px rgba(27, 197, 189, 0.2);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(27, 197, 189, 0.05);
    }
}

@keyframes pulse-orange {

    0%,
    100% {
        box-shadow: 0 0 0 2px rgba(255, 168, 0, 0.3);
        opacity: 1;
    }

    50% {
        box-shadow: 0 0 0 5px rgba(255, 168, 0, 0.05);
        opacity: 0.5;
    }
}

/* =============================================================================
   Modern Action Buttons
   ============================================================================= */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.action-btn i {
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

/* View / Detail button */
.action-btn-view {
    background: rgba(54, 153, 255, 0.1);
    color: var(--primary);
}

.action-btn-view:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(54, 153, 255, 0.3);
    transform: translateY(-1px);
}

.action-btn-view:hover i {
    transform: scale(1.15);
}

/* Close / Delete button */
.action-btn-close {
    background: rgba(246, 78, 96, 0.1);
    color: var(--danger);
}

.action-btn-close:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 3px 10px rgba(246, 78, 96, 0.3);
    transform: translateY(-1px);
}

.action-btn-close:hover i {
    transform: scale(1.15);
}



/* =============================================================================
   SSE Notification Toast
   ============================================================================= */
.sse-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1050;
    min-width: 300px;
    border-radius: var(--radius);
    animation: slideInToast 0.4s ease-out;
}

@keyframes slideInToast {
    from {
        opacity: 0;
        transform: translateX(80px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}