/* CSS VARIABLES FOR MODERN HARMONIOUS PALETTE */
:root {
    --bg-primary: #0a0b10;
    --bg-secondary: #10121d;
    --panel-bg: rgba(18, 22, 40, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-border-focus: rgba(124, 58, 237, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --color-primary: #7c3aed; /* Royal Violet */
    --color-primary-glow: rgba(124, 58, 237, 0.3);
    --color-accent: #2563eb; /* Cobalt Blue */
    --color-accent-glow: rgba(37, 99, 235, 0.3);
    
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #06b6d4;

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* BACKGROUND BLOBS & GRID OVERLAY */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
    animation: pulse 10s infinite alternate;
}

.blob-purple {
    background: var(--color-primary);
    width: 500px;
    height: 500px;
    top: -10%;
    left: -10%;
}

.blob-blue {
    background: var(--color-accent);
    width: 600px;
    height: 600px;
    bottom: -10%;
    right: -10%;
    animation-delay: 2s;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0px, 0px); }
    100% { transform: scale(1.15) translate(30px, -40px); }
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
    z-index: -1;
    pointer-events: none;
}

/* CONTAINER */
.app-container {
    width: 100%;
    max-width: 1100px;
    min-height: 90vh;
    margin: 24px;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    margin-bottom: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    color: var(--color-primary);
    width: 28px;
    height: 28px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

.status-dot.green {
    color: var(--color-success);
    background: var(--color-success);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
}

/* CARD FLIP ANIMATION SETUP */
.auth-card-wrapper {
    perspective: 1000px;
    width: 100%;
    max-width: 460px;
}

.auth-card {
    width: 100%;
    height: 520px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.auth-card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    border-radius: var(--border-radius);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-back {
    transform: rotateY(180deg);
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* FORMS & INPUTS */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 24px 0;
}

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

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    transition: var(--transition-smooth);
}

.input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 14px 14px 14px 44px;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
}

.input-wrapper input:focus {
    border-color: var(--panel-border-focus);
    box-shadow: 0 0 12px var(--color-primary-glow);
    background: rgba(0, 0, 0, 0.4);
}

.input-wrapper input:focus + .input-icon {
    color: var(--color-primary);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    color: white;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.5);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-accent), #3b82f6);
    color: white;
    box-shadow: 0 4px 15px var(--color-accent-glow);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
}

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

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

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.btn-full {
    width: 100%;
}

.btn:active {
    transform: translateY(0);
}

.card-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.card-footer a:hover {
    text-decoration: underline;
    color: #a78bfa;
}

/* DASHBOARD PANEL */
.dashboard-wrapper {
    width: 100%;
    animation: fadeIn 0.5s ease-out forwards;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
}

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

.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.profile-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary-glow), var(--color-accent-glow));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-primary);
    box-shadow: 0 8px 24px var(--color-primary-glow);
    margin-bottom: 16px;
}

.avatar-icon {
    width: 36px;
    height: 36px;
    color: var(--color-primary);
}

.profile-panel h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
}

.role-badge {
    background: var(--color-primary-glow);
    color: #c084fc;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 8px;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.profile-details {
    width: 100%;
    margin: 28px 0;
    border-top: 1px solid var(--panel-border);
    border-bottom: 1px solid var(--panel-border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-secondary);
}

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

.detail-value.highlight {
    color: var(--color-info);
}

.panel-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* INSPECTOR PANEL & TABS */
.info-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.tabs-header {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 24px;
}

.tab-btn {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding-bottom: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

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

.tab-btn.hidden {
    display: none !important;
}

.tab-panel.hidden {
    display: none !important;
}

/* ADMIN PANEL STYLES */
.users-table-container {
    width: 100%;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    margin-top: 12px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-align: left;
}

.users-table th, 
.users-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
}

.users-table th {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
}

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

.users-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.form-group-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.form-group-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

@media (max-width: 576px) {
    .form-group-row {
        flex-direction: column;
        gap: 12px;
    }
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
}

.btn-action {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-smooth);
}

.btn-action:hover:not(:disabled) {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-color: transparent;
}

.mt-3 {
    margin-top: 12px;
}

.tab-icon {
    color: var(--color-info);
}

.inspector-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 20px;
}

.mt-4 {
    margin-top: 24px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-title h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.badge-cookie {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-db {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.cookie-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cookie-key {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.cookie-value-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cookie-value-box code {
    font-family: monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    word-break: break-all;
}

.info-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.info-icon:hover {
    color: var(--color-info);
}

/* Tooltip */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    visibility: hidden;
    width: 250px;
    background-color: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    right: 0;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.tooltip-container:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.cookie-meta {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cookie-meta strong {
    font-weight: 600;
}

.green { color: var(--color-success) !important; }
.blue { color: var(--color-accent) !important; }

/* SQL BOX */
.sql-box {
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    font-family: monospace;
    font-size: 0.85rem;
}

.sql-code {
    padding: 12px;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.5;
}

.sql-keyword {
    color: #f43f5e;
    font-weight: bold;
}

.sql-string {
    color: #10b981;
}

.sql-result {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.result-row:last-child {
    margin-bottom: 0;
}

.res-lbl {
    color: var(--text-muted);
}

.res-val {
    font-weight: 600;
}

.font-mono {
    font-family: monospace;
}

/* CONSOLE / LOGS */
.console-footer {
    margin-top: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 18px;
    border-bottom: 1px solid var(--panel-border);
}

.console-title {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-icon {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
}

.console-clear-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
}

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

.console-logs {
    padding: 14px 18px;
    height: 120px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry {
    line-height: 1.4;
}

.log-entry.system { color: #38bdf8; }
.log-entry.success { color: #4ade80; }
.log-entry.error { color: #f87171; }
.log-entry.info { color: #a78bfa; }

.log-time {
    color: var(--text-muted);
    margin-right: 8px;
}

/* TOASTS */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    backdrop-filter: blur(8px);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition-smooth);
}

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

.toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.info .toast-icon { color: var(--color-info); }

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 2px;
}

.toast-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* SUB-TABS (RBAC) STYLING */
.sub-tabs-header {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    align-self: flex-start;
    width: fit-content;
}

.sub-tab-btn {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: var(--transition-smooth);
}

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

.sub-tab-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sub-tab-panel.hidden {
    display: none !important;
}

.form-select {
    width: 100%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    padding: 12px 12px 12px 40px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

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

.hidden {
    display: none !important;
}

/* REGISTER NOTICE */
.register-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 8px;
    padding: 14px 16px;
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.2);
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.register-notice .notice-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    color: #eab308;
}

.register-notice a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
}

.register-notice a:hover {
    text-decoration: underline;
    color: #93bbfc;
}
