* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --dark-lighter: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --navbar-height: 64px;
    --sidebar-width: 260px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* Prevent body scroll when sidebar is open on mobile */
body.sidebar-open {
    overflow: hidden;
}

/* Auth Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--dark-light);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px var(--shadow);
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--primary-light);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #db2777);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary-light);
}

/* =========================================
   New Dashboard Layout
   ========================================= */

/* Top Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--dark-light);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.navbar-brand img {
    height: 32px;
}

.navbar-brand span {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hamburger Menu (Mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* User Profile Dropdown */
.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    border: 2px solid var(--dark-light);
    box-shadow: 0 0 0 2px var(--primary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 200px;
    background: var(--dark-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 8px;
    display: none;
    z-index: 1001;
    animation: slideDown 0.2s ease;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--dark-light);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 900;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 30px;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left 0.3s ease;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.page-header p {
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--dark-light);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1.3rem;
    color: var(--text);
}

.card-body {
    color: var(--text);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--dark-light);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 10px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--dark);
    border-radius: 10px;
    overflow: hidden;
}

thead {
    background: rgba(99, 102, 241, 0.1);
}

th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    color: var(--text);
}

tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

/* Host Grid */
.host-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.host-card {
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.host-card:hover {
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.2);
}

.host-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.host-card-header h4 {
    font-size: 1.2rem;
    color: var(--text);
}

.host-card-body {
    margin-bottom: 15px;
}

.host-card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Upload Section */
.upload-section {
    background: var(--dark);
    border: 2px dashed var(--border);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.upload-section:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

/* Links */
a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

/* File URL Display */
.file-urls {
    background: var(--dark);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
}

.file-url-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.file-url-item:last-child {
    border-bottom: none;
}

.copy-btn {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 850;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* =========================================
   Responsive Design
   ========================================= */

@media (max-width: 768px) {

    /* Show hamburger menu */
    .menu-toggle {
        display: block;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        top: 0;
        height: 100vh;
        padding-top: calc(var(--navbar-height) + 20px);
        z-index: 950;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    }

    /* Show sidebar when open */
    .sidebar.open {
        transform: translateX(0);
    }

    /* Remove left margin from main content */
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        width: 100%;
        overflow-x: hidden;
    }

    /* Stack stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Stack host grid */
    .host-grid {
        grid-template-columns: 1fr;
    }

    /* Adjust navbar brand */
    .navbar-brand span {
        font-size: 1.1rem;
    }

    /* Adjust page header */
    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Adjust card padding */
    .card {
        padding: 20px 15px;
        border-radius: 12px;
    }

    /* Make tables scroll horizontally - but only for non-card layouts */
    .table-container {
        margin: 0 -15px;
        padding: 0 15px;
    }

    /* Only apply min-width to tables that don't have card-based mobile layout */
    table:not(.ak-table) {
        min-width: 600px;
    }

    table:not(.ak-table) th,
    table:not(.ak-table) td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    /* Adjust buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    /* Stack form groups better */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Adjust alerts */
    .alert {
        padding: 12px 15px;
        font-size: 0.85rem;
    }

    /* Adjust stat cards */
    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    /* Host card adjustments */
    .host-card {
        padding: 15px;
    }

    .host-card-footer {
        flex-direction: column;
    }

    .host-card-footer .btn {
        width: 100%;
    }

    /* Upload section */
    .upload-section {
        padding: 30px 20px;
    }

    .upload-icon {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {

    /* Further adjustments for very small screens */
    .navbar {
        padding: 0 15px;
    }

    .main-content {
        padding: 15px 10px;
        width: 100%;
        overflow-x: hidden;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .page-header p {
        font-size: 0.85rem;
    }

    .card {
        padding: 15px 12px;
    }

    .card-header h3 {
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }
}

/* =========================================
   Global Scrollbar Styles
   ========================================= */

/* WebKit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--dark-lighter), #475569);
    border-radius: 5px;
    border: 2px solid var(--dark);
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #475569, var(--primary));
}

::-webkit-scrollbar-corner {
    background: var(--dark);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--dark-lighter) var(--dark);
}

/* Thin scrollbar for specific containers */
.sidebar::-webkit-scrollbar,
.table-container::-webkit-scrollbar,
.notification-dropdown::-webkit-scrollbar,
#notificationList::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb,
.notification-dropdown::-webkit-scrollbar-thumb,
#notificationList::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
    border: none;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover,
.notification-dropdown::-webkit-scrollbar-thumb:hover,
#notificationList::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* =========================================
   Notification Dropdown Styles
   ========================================= */

.notification-dropdown {
    display: none;
    position: fixed;
    top: 60px;
    right: 10px;
    margin-top: 10px;
    background: var(--dark-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: calc(100vw - 20px);
    max-width: 400px;
    max-height: calc(100vh - 80px);
    overflow: hidden;
    z-index: 10000;
    flex-direction: column;
    animation: notificationSlideIn 0.2s ease;
}

.notification-dropdown.show {
    display: flex;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-dropdown .notification-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.notification-dropdown .notification-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

#notificationList {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 400px;
}

#markAllReadBtn {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.2s;
}

#markAllReadBtn:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Notification item styles */
.notification-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.notification-item-message {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.notification-item-message a {
    color: var(--primary-light);
    text-decoration: none;
}

.notification-item-message a:hover {
    text-decoration: underline;
}

.notification-item-message b,
.notification-item-message strong {
    font-weight: 700;
    color: var(--text);
}

.notification-item-message i,
.notification-item-message em {
    font-style: italic;
}

.notification-item-message u {
    text-decoration: underline;
}

.notification-item-message s,
.notification-item-message strike {
    text-decoration: line-through;
    opacity: 0.7;
}

.notification-item-date {
    font-size: 0.75rem;
    color: #64748b;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* Mobile responsive notification dropdown */
@media (max-width: 768px) {
    .notification-dropdown {
        right: 10px;
        left: 10px;
        width: calc(100vw - 20px);
        max-width: none;
        top: 60px;
    }
}