/* ==========================================
   GLOBAL STYLES
   ========================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0e1a;
    min-height: 100vh;
    padding: 20px;
    color: #e8edf5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================
   USER BAR
   ========================================== */

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(145deg, #131b33, #0d1424);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    gap: 10px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.user-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 4px 14px;
    border-radius: 20px;
    font-weight: 600;
}

.user-id {
    color: #64748b;
    font-size: 0.8rem;
}

.logout-btn {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* ==========================================
   HEADER
   ========================================== */

.header {
    text-align: center;
    padding: 30px 30px;
    background: linear-gradient(145deg, #131b33, #0d1424);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
}

.header h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    background: linear-gradient(135deg, #e8edf5 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.header p {
    color: #94a3b8;
    font-size: 1rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

.badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-top: 10px;
}

/* ==========================================
   GRID & CARDS
   ========================================== */

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 800px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: linear-gradient(145deg, #131b33, #0d1424);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.card h2 {
    color: #e8edf5;
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 .icon {
    font-size: 22px;
}

/* ==========================================
   STATS
   ========================================== */

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 20px;
    border-radius: 10px;
    flex: 1;
    text-align: center;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: #818cf8;
}

.stat-number.stat-success {
    color: #34d399;
}

.stat-label {
    color: #64748b;
    font-size: 12px;
}

/* ==========================================
   FORMS
   ========================================== */

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

.form-group label {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group label .required {
    color: #f87171;
    margin-left: 4px;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #e8edf5;
    font-size: 14px;
    font-family: 'Consolas', monospace;
    transition: all 0.3s ease;
    resize: vertical;
}

.form-group textarea {
    min-height: 80px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
}

.form-group textarea:focus,
.form-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.form-group .hint {
    color: #64748b;
    font-size: 12px;
    margin-top: 4px;
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
    padding: 14px 30px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, #059669, #34d399);
    color: #fff;
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(52, 211, 153, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.4);
}

.btn-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    color: #818cf8;
    border: 1.5px solid rgba(99, 102, 241, 0.3);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    width: auto;
    display: inline-block;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1;
    min-width: 80px;
}

/* ==========================================
   RESULTS
   ========================================== */

.results-container {
    margin-top: 30px;
}

.result-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-left: 4px solid #6366f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.result-item.success {
    border-left-color: #34d399;
}

.result-item.error {
    border-left-color: #ef4444;
}

.result-item .info {
    flex: 1;
}

.result-item .info .name {
    font-weight: 600;
    color: #e8edf5;
}

.result-item .info .key {
    font-family: 'Consolas', monospace;
    color: #fbbf24;
    font-size: 13px;
    margin-top: 4px;
}

.result-item .info .instance {
    color: #64748b;
    font-size: 12px;
}

.result-item .status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ==========================================
   VOD LIST
   ========================================== */

.vod-list {
    max-height: 400px;
    overflow-y: auto;
}

.vod-list::-webkit-scrollbar {
    width: 6px;
}

.vod-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.vod-list::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 10px;
}

.vod-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.vod-item .vod-info {
    flex: 1;
}

.vod-item .vod-info .vod-title {
    font-weight: 600;
    color: #e8edf5;
}

.vod-item .vod-info .vod-key {
    font-family: 'Consolas', monospace;
    color: #fbbf24;
    font-size: 12px;
    margin-top: 2px;
}

.vod-item .vod-info .vod-id {
    color: #64748b;
    font-size: 11px;
}

.vod-item .vod-actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

/* ==========================================
   LOADING
   ========================================== */

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.15);
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #34d399);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    margin-top: 8px;
}

/* ==========================================
   TOAST
   ========================================== */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', sans-serif;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #059669, #34d399);
}

.toast.error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast.info {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

/* ==========================================
   KEY UPDATED BADGE
   ========================================== */

.key-updated-badge {
    display: inline-block;
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
}

/* ==========================================
   LOGIN PAGE
   ========================================== */

.login-container {
    max-width: 450px;
    width: 100%;
    background: linear-gradient(145deg, #131b33, #0d1424);
    border-radius: 20px;
    padding: 40px 32px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    margin: auto;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.login-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #e8edf5 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-container p {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.instructions {
    background: rgba(255, 255, 255, 0.04);
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.instructions p {
    font-size: 0.85rem;
    font-weight: 600;
    color: #c8d0dc;
    margin-bottom: 8px;
}

.instructions ol {
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.8;
    padding-left: 20px;
}

.instructions code {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.instructions a {
    color: #818cf8;
    text-decoration: none;
}

.instructions a:hover {
    text-decoration: underline;
}

.login-form input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #e8edf5;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    margin-bottom: 14px;
    text-align: center;
}

.login-form input::placeholder {
    color: #64748b;
}

.login-form input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.login-form button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}

.login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #818cf8, #4f46e5);
}

.login-footer {
    margin-top: 16px;
    font-size: 0.75rem;
    color: #64748b;
}

/* ==========================================
   SELECT
   ========================================== */

.form-select {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #e8edf5;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-select option {
    background: #131b33;
    color: #e8edf5;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 30px;
}

.footer a {
    color: #818cf8;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 480px) {
    .login-container {
        padding: 28px 20px;
    }
    
    .login-container h1 {
        font-size: 1.4rem;
    }
    
    .btn-group .btn {
        flex: 1 1 100%;
    }
    
    .vod-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .vod-item .vod-actions {
        width: 100%;
    }
    
    .vod-item .vod-actions .btn {
        flex: 1;
    }
}

/* ==========================================
   TAB NAVIGATION
   ========================================== */

.tab-nav {
    display: flex;
    gap: 4px;
    background: linear-gradient(145deg, #131b33, #0d1424);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #e8edf5;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==========================================
   SERIES LIST ITEMS
   ========================================== */

.series-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.series-item .series-info {
    flex: 1;
}

.series-item .series-info .series-title {
    font-weight: 600;
    color: #e8edf5;
}

.series-item .series-info .series-details {
    color: #94a3b8;
    font-size: 12px;
    margin-top: 2px;
}

.series-item .series-info .series-id {
    color: #64748b;
    font-size: 11px;
    margin-top: 2px;
}

.series-item .series-actions {
    display: flex;
    gap: 8px;
}

/* ==========================================
   SERIES LIST SCROLL
   ========================================== */

.series-list {
    max-height: 400px;
    overflow-y: auto;
}

.series-list::-webkit-scrollbar {
    width: 6px;
}

.series-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.series-list::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 10px;
}