/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #090a0f;
    --bg-card: rgba(20, 24, 38, 0.6);
    --bg-card-hover: rgba(30, 36, 56, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    
    --primary-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-color: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.3);
    
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-red: #f43f5e;
    --accent-yellow: #fbbf24;
    
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --glass-blur: blur(16px) saturate(180%);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background decorative glowing orbs */
body::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-grad);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: var(--primary-grad);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 700;
    border: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-red);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1);
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 2.5rem;
    min-height: 100vh;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Default password warning banner */
.warning-banner {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: slideDown 0.4s ease-out;
}

.warning-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-yellow);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.25);
    color: #fff;
}

/* Stats Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--bg-card-hover);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
}

.stat-icon.primary { color: var(--primary-color); background: rgba(99, 102, 241, 0.1); }
.stat-icon.success { color: var(--accent-green); background: rgba(16, 185, 129, 0.1); }
.stat-icon.danger { color: var(--accent-red); background: rgba(244, 63, 94, 0.1); }
.stat-icon.cyan { color: var(--accent-cyan); background: rgba(6, 182, 212, 0.1); }

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

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Content Sections */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

/* Card / Tables Section */
.card-section {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.card-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.search-bar {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    max-width: 350px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Table Style */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.15rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-suspended { background: rgba(244, 63, 94, 0.15); color: var(--accent-red); }
.badge-expired { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }
.badge-blocked { background: rgba(244, 63, 94, 0.2); color: var(--accent-red); }

/* Forms & Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 10, 15, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #121625;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    padding: 2.25rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Key Copy Box */
.license-key-display {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.key-text {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent-cyan);
    font-size: 1rem;
    flex-grow: 1;
    letter-spacing: 1px;
}

.copy-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.copy-icon-btn:hover {
    color: var(--primary-color);
}

/* Login Page Styling */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.5s ease-out;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    width: 54px;
    height: 54px;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Error message banner */
.error-message {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: var(--accent-red);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: none;
    font-weight: 500;
}

.error-message.active {
    display: block;
}

/* Key Verification Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.details-row {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.details-row:last-child {
    border-bottom: none;
}

.details-label {
    color: var(--text-muted);
    font-weight: 500;
}

.details-value {
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsiveness */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2rem 0.75rem;
        align-items: center;
    }
    
    .logo-text, .user-info, .sidebar-footer span, .nav-item span {
        display: none;
    }
    
    .logo-container {
        margin-bottom: 2rem;
    }
    
    .main-content {
        margin-left: 80px;
        padding: 1.5rem;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .card-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-bar {
        max-width: 100%;
    }
}

/* API & Integration Page Layout */
.integration-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

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

.integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.script-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

.script-selector span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.script-selector select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    padding-right: 0.5rem;
}

.script-selector select option {
    background: #121625;
    color: var(--text-primary);
}

/* Sub tabs styling */
.integration-subtabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    gap: 0.5rem;
    overflow-x: auto;
}

.subtab-btn {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.subtab-btn:hover {
    color: var(--text-primary);
}

.subtab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Code container styling */
.code-container {
    position: relative;
    margin-top: 1rem;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(20, 24, 38, 0.9);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 0.75rem 1.25rem;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.code-header .lang-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

.code-box {
    background: #05070c;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    padding: 1.25rem;
    overflow-x: auto;
    max-height: 450px;
}

.code-box pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.55;
    color: #cbd5e1;
    white-space: pre;
}

.api-method-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-right: 0.5rem;
}

.api-method-badge.post {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.api-url-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.api-url-text {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex-grow: 1;
    word-break: break-all;
}

.api-param-table {
    margin-bottom: 1.5rem;
}

.api-param-table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
}

.api-param-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
}

/* Offline Mode Styling */
.offline-banner {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: slideDown 0.4s ease-out;
}

.offline-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-yellow);
    font-weight: 500;
    font-size: 0.9rem;
}

.offline-banner-content svg {
    color: var(--accent-yellow);
    animation: pulse 2s infinite;
}

.pending-sync-row {
    opacity: 0.65;
    border-left: 3px dashed var(--accent-yellow) !important;
    background: rgba(251, 191, 36, 0.02) !important;
}

.pending-sync-row td {
    border-bottom: 1px dashed rgba(251, 191, 36, 0.2) !important;
}

.pending-sync-row .copy-icon-btn, 
.pending-sync-row button {
    pointer-events: none !important;
    opacity: 0.5;
}

/* Toast Container & Notification Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.sync-toast {
    background: rgba(18, 22, 37, 0.95);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: 280px;
    max-width: 380px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideInLeft 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sync-toast.success {
    border-left: 4px solid var(--accent-green);
}

.sync-toast.warning {
    border-left: 4px solid var(--accent-yellow);
}

.sync-toast.info {
    border-left: 4px solid var(--primary-color);
}

.sync-toast.error {
    border-left: 4px solid var(--accent-red);
}

/* Additional animations */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Script product image thumbnails in tables */
.script-info-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.script-thumbnail {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}
