:root {
    --bg-dark: #0f111a;
    --sidebar-bg: #1a1d2b;
    --card-bg: #1e2235;
    --accent: #00d2ff;
    --accent-hover: #00b8e6;
    --text-main: #ffffff;
    --text-muted: #a0aec0;
    --danger: #ff4d4d;
    --warning: #ffb86c;
    --success: #50fa7b;
    --info: #8be9fd;
    --border: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.brand {
    margin-bottom: 32px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--accent), #3a7bd5);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    margin-bottom: 12px;
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.brand h1 span {
    color: var(--accent);
    font-size: 0.9rem;
    margin-left: 4px;
}

.sidebar-nav {
    margin-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    margin-bottom: 8px;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--accent);
}

.section-divider {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-divider::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background: var(--border);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
}

.validation-msg {
    display: block;
    font-size: 0.7rem;
    margin-top: 4px;
}

.validation-msg.valid {
    color: var(--success);
}

.validation-msg.invalid {
    color: var(--danger);
}

.actions-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.btn {
    padding: 10px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-secondary {
    background: #3a7bd5;
    color: #fff;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-info {
    background: var(--info);
    color: #000;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Removed sidebar footer */

/* Main Content */
.content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(0, 210, 255, 0.03), transparent 40%);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.content-header h2 {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.content-header p {
    color: var(--text-muted);
}

.btn-refresh-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-refresh-circle:hover {
    background: var(--accent);
    color: #000;
    transform: rotate(180deg);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.table-container {
    padding: 1px;
    overflow: hidden;
    position: relative;
    min-height: 300px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(0, 0, 0, 0.4);
    padding: 16px 24px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    font-weight: 700;
}

td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(80, 250, 123, 0.1);
    color: var(--success);
}

.badge-inactive {
    background: rgba(255, 77, 77, 0.1);
    color: var(--danger);
}

.row-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon:hover {
    background: var(--accent);
    color: #000;
}

.log-section {
    margin-top: 24px;
    padding: 20px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.log-view {
    height: 120px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #12141e;
    padding: 12px;
    border-radius: 6px;
}

.log-entry {
    margin-bottom: 4px;
}

.log-time {
    color: var(--accent);
    opacity: 0.7;
    margin-right: 8px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.hidden {
    display: none !important;
}

.modal-content {
    width: 500px;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.activations-list {
    list-style: none;
}

.activation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 34, 53, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
}

/* Login Page Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-card {
    width: 360px;
    padding: 40px;
    text-align: center;
}

.login-card .brand {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 15px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.mobile-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1500;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #000;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1100;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content {
        padding: 20px;
        padding-top: 80px;
    }

    .content-header {
        flex-direction: column;
        gap: 15px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .modal-content {
        width: 95%;
        padding: 15px;
    }

    .login-card {
        width: 90%;
        padding: 25px;
    }
}

@media (max-width: 600px) {
    .row-actions {
        flex-direction: column;
        gap: 5px;
    }

    .btn-icon {
        width: 100%;
        justify-content: center;
    }

    .actions-stack .btn {
        font-size: 0.75rem;
    }
}