/**
 * Smart Redirect & Lead Capture - Admin Dashboard Styling
 * -------------------------------------------------------------
 * Features glassmorphic cards, harmony slate gradients, responsive layouts,
 * premium buttons, responsive sidebars, data listings, and interactive modals.
 */

/* ==========================================================================
   1. System Variables
   ========================================================================== */
   :root {
    --admin-bg-body: #080c14;
    --admin-bg-sidebar: #0e1320;
    --admin-bg-glass: rgba(18, 25, 41, 0.6);
    --admin-border-glass: rgba(255, 255, 255, 0.05);
    --admin-border-hover: rgba(255, 255, 255, 0.1);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.25);
    
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;
    
    --text-main: #f3f4f6;
    --text-sub: #9ca3af;
    --text-disabled: #4b5563;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --font-family: 'Outfit', sans-serif;
}

/* ==========================================================================
   2. Reset & Core Structure
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--admin-bg-body);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar customizations */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--admin-bg-body);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* ==========================================================================
   3. Grid Layout
   ========================================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styling */
.admin-sidebar {
    width: 260px;
    background: var(--admin-bg-sidebar);
    border-right: 1px solid var(--admin-border-glass);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.logo-text span {
    color: var(--primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-sub);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

/* Sidebar User Info Block */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 10px;
    border-top: 1px solid var(--admin-border-glass);
    margin-top: 20px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
}

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

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.user-role {
    font-size: 11px;
    color: var(--text-sub);
}

.btn-logout {
    color: var(--text-sub);
    transition: all 0.2s ease;
}

.btn-logout:hover {
    color: var(--accent-danger);
}

.logout-icon {
    width: 20px;
    height: 20px;
}

/* Content Area */
.admin-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Navigation Bar */
.admin-topbar {
    background: rgba(8, 12, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--admin-border-glass);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.topbar-title p {
    font-size: 13px;
    color: var(--text-sub);
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.system-time {
    font-size: 12px;
    color: var(--text-sub);
}

.btn-view-site {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--admin-border-glass);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-view-site:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.external-icon {
    width: 14px;
    height: 14px;
}

/* Main content frame */
.admin-main {
    padding: 40px;
    flex-grow: 1;
}

/* ==========================================================================
   4. Dashboard Metric Widgets
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.metric-card {
    background: var(--admin-bg-glass);
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.01) 0%, transparent 60%);
    pointer-events: none;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-icon-box {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.metric-icon-box.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-success); }
.metric-icon-box.yellow { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.03em;
}

.metric-trend {
    font-size: 12px;
    color: var(--text-sub);
}

.metric-trend span {
    font-weight: 600;
}

.trend-positive { color: var(--accent-success); }
.trend-negative { color: var(--accent-danger); }

/* ==========================================================================
   5. Interactive Generator / Forms
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 32px;
    align-items: start;
    margin-bottom: 40px;
}

.content-card {
    background: var(--admin-bg-glass);
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title-bar h2 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
}

.input-ctrl {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 14px;
    height: 48px;
    padding: 0 16px;
    outline: none;
    transition: all 0.25s ease;
}

.input-ctrl:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.input-ctrl {
    height: auto;
    padding: 12px 16px;
}

/* Action Buttons */
.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    height: 48px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    box-shadow: 0 4px 12px var(--primary-glow);
    transition: all 0.25s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    height: 38px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--admin-border-hover);
}

.btn-danger {
    background: var(--accent-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background: #dc2626;
}

/* ==========================================================================
   6. Data Tables & Lists
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.admin-table th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--admin-border-glass);
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border-glass);
    font-size: 14px;
    color: var(--text-main);
    vertical-align: middle;
}

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

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* URL and Link Styling inside Table */
.tbl-url-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
}

.tbl-short-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-family: monospace;
}

.tbl-short-link:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-blue { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.badge-green { background: rgba(16, 185, 129, 0.1); color: var(--accent-success); }
.badge-orange { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }

/* Output Generator Display Box */
.output-link-box {
    background: rgba(16, 185, 129, 0.05);
    border: 1px dashed rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 24px;
    display: none;
    animation: fadeIn 0.4s ease;
}

.output-link-box.active {
    display: block;
}

.output-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-success);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.output-url-flex {
    display: flex;
    gap: 12px;
}

.output-url-flex input {
    flex-grow: 1;
    background: #0f172a;
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-sm);
    color: #ffffff;
    height: 38px;
    padding: 0 12px;
    font-family: monospace;
    font-size: 13px;
    outline: none;
}

/* ==========================================================================
   7. Modals / QR Codes Overlay
   ========================================================================== */
.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 12, 20, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.qr-modal-card {
    background: #111827;
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 320px;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.qr-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    font-size: 20px;
}

.qr-close-btn:hover {
    color: #ffffff;
}

.qr-image-container {
    background: #ffffff;
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 20px 0;
    display: inline-block;
}

.qr-image-container img {
    display: block;
    width: 180px;
    height: 180px;
}

/* ==========================================================================
   8. Login Panel Styling (Isolated layout)
   ========================================================================== */
.login-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    background: radial-gradient(circle at 50% 30%, rgba(59,130,246,0.06) 0%, transparent 60%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--admin-bg-glass);
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    backdrop-filter: blur(14px);
    text-align: center;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.login-logo .logo-icon {
    font-size: 28px;
}

.login-logo .logo-text {
    font-size: 24px;
}

.login-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
    font-size: 13px;
    font-weight: 500;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    text-align: left;
}

/* ==========================================================================
   9. Custom native charts (Dynamic SVG styling)
   ========================================================================== */
.chart-container-bar {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    border-bottom: 1.5px solid var(--admin-border-glass);
    padding: 20px 10px 10px 10px;
    margin-bottom: 12px;
}

.chart-bar-col {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-pillar {
    width: 100%;
    max-width: 44px;
    background: linear-gradient(180deg, var(--primary) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: height 1s ease-in-out;
}

.chart-bar-pillar:hover {
    background: linear-gradient(180deg, var(--primary-hover) 0%, rgba(59, 130, 246, 0.4) 100%);
}

.chart-bar-label {
    font-size: 11px;
    color: var(--text-sub);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.chart-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.08);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.chart-bar-pillar:hover .chart-tooltip {
    opacity: 1;
}

/* ==========================================================================
   10. Media Queries / Mobile Responsiveness
   ========================================================================== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 16px;
        border-right: none;
        border-bottom: 1px solid var(--admin-border-glass);
    }
    
    .sidebar-logo {
        margin-bottom: 15px;
    }
    
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .sidebar-user {
        border-top: none;
        margin-top: 10px;
        padding: 10px 0;
    }

    .admin-topbar {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .admin-main {
        padding: 20px;
    }
}

/* ==========================================================================
   11. Advanced Social Previews & Custom Domain Panel
   ========================================================================== */
.advanced-toggle-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--admin-border-glass);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    transition: all 0.2s ease;
    margin-top: 15px;
    user-select: none;
}

.advanced-toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.advanced-toggle-btn.active {
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.advanced-toggle-btn.active .toggle-arrow {
    transform: rotate(180deg);
}

.toggle-arrow {
    font-size: 10px;
    transition: transform 0.25s ease;
    display: inline-block;
}

.advanced-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.advanced-panel.active {
    max-height: 600px;
    opacity: 1;
    transition: max-height 0.4s ease-in, opacity 0.3s ease-in;
}

.field-hint {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 4px;
    line-height: 1.4;
}

