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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

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

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box h1 {
    text-align: center;
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.login-box .subtitle {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-bottom: 30px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.login-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.login-box input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-box .btn-submit {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.login-box .btn-submit:hover {
    background: #1d4ed8;
}

.login-box .error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}

/* ========== Admin Layout ========== */
.admin-header {
    background: #1a1a2e;
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.admin-header .logo {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

.admin-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header .header-right .username {
    color: #94a3b8;
    font-size: 14px;
}

.admin-header .header-right a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.admin-header .header-right a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.admin-body {
    display: flex;
    padding-top: 56px;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 200px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 16px 0;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.admin-sidebar .nav-item {
    display: block;
    padding: 12px 20px;
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.admin-sidebar .nav-item:hover {
    background: #f8fafc;
    color: #2563eb;
}

.admin-sidebar .nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}

.admin-sidebar .nav-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Main Content */
.admin-content {
    margin-left: 200px;
    flex: 1;
    padding: 24px;
    min-height: calc(100vh - 56px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.card-body {
    padding: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2563eb;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

table tr:hover td {
    background: #f9fafb;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

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

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    color: #374151;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    max-width: 500px;
}

.form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-control {
    cursor: pointer;
}

.form-help {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Tags / Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.badge-blue {
    background: #eff6ff;
    color: #2563eb;
}

.badge-green {
    background: #ecfdf5;
    color: #059669;
}

.badge-red {
    background: #fef2f2;
    color: #dc2626;
}

.badge-yellow {
    background: #fffbeb;
    color: #d97706;
}

/* Alert / Message */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Subscription URL display */
.sub-url {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 14px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 13px;
    word-break: break-all;
    color: #2563eb;
    margin-top: 8px;
    display: block;
}

.copy-btn {
    margin-top: 8px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

.empty-state p {
    font-size: 14px;
    margin-top: 8px;
}

/* Utility */
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: #9ca3af; font-size: 13px; }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }
    .admin-content {
        margin-left: 0;
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}


/* ========== Search Bar ========== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.search-bar .form-control {
    max-width: 350px;
}

.search-bar .btn {
    white-space: nowrap;
}

/* ========== Modal Overlay ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    width: 420px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}

.modal-box h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
}

.modal-close:hover {
    color: #374151;
}

/* ========== QR Code ========== */
.qr-container {
    text-align: center;
    padding: 16px 0;
}

.qr-container img {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.qr-container .sub-url-display {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 14px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    word-break: break-all;
    color: #2563eb;
    margin: 8px 0;
    text-align: left;
    max-height: 80px;
    overflow-y: auto;
}

.qr-container .btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* ========== Expiry Modal Form ========== */
.expiry-form .form-group {
    margin-bottom: 16px;
}

.expiry-form .form-group label {
    display: block;
    font-size: 14px;
    color: #374151;
    margin-bottom: 6px;
    font-weight: 500;
}

.expiry-form .form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.expiry-form .form-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== Action button colors ========== */
.btn-info {
    background: #06b6d4;
    color: #fff;
}
.btn-info:hover {
    background: #0891b2;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}
.btn-secondary:hover {
    background: #4b5563;
}

/* ========== Status badges for disabled ========== */
.badge-gray {
    background: #f3f4f6;
    color: #6b7280;
}
