:root {
    /* Solid Dark Theme Palette -> Glassmorphism */
    --bg-main: #0B0710;
    --bg-sidebar: rgba(18, 18, 23, 0.75);
    --bg-card: rgba(28, 28, 36, 0.65);
    --bg-card-hover: rgba(35, 35, 45, 0.85);
    --bg-input: rgba(0, 0, 0, 0.4);
    
    --accent-primary: #FF2A85;
    --accent-secondary: #FF66A3;
    
    --text-primary: #ffffff;
    --text-secondary: #8f8f9d;
    --text-muted: #5e5e6b;
    
    --danger: #FF3333;
    --success: #20b05b;
    --warning: #f5a623;
    
    /* Brand Colors */
    --platform-netflix: #E50914;
    --platform-disney: #113CCF;
    --platform-spotify: #1DB954;
    --platform-amazon: #FF9900;
    --platform-hbo: #5822B4;
    
    --font-family: 'Outfit', sans-serif;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-radius: 12px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(255, 42, 133, 0.18), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(255, 102, 163, 0.15), transparent 40%);
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite alternate;
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 42, 133, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 42, 133, 0.6);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent-primary); }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-0 { margin-bottom: 0 !important; }
.flex-1 { flex: 1; }
.flex-grow { flex-grow: 1; }
.ml-2 { margin-left: 0.5rem; }

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 42, 133, 0.1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: 2px 0 20px rgba(0,0,0,0.3);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.sidebar-logo {
    height: 32px;
    width: auto;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 42, 133, 0.1);
    color: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

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

.user-role {
    font-weight: 700;
    font-size: 0.9rem;
}

.user-status {
    font-size: 0.75rem;
    color: var(--success);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    width: 100%;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 42, 133, 0.1);
    color: var(--accent-primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    max-height: 100vh;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

#view-login.active {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 5rem);
}

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

.view-header {
    margin-bottom: 2rem;
    text-align: center;
}

.view-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Panel Cards */
.panel-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.panel-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 42, 133, 0.3), transparent);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Forms & Inputs */
.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

input.input-modern, select.input-modern {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.input-group input, .input-group select {
    padding-left: 2.8rem;
}

input.input-modern:focus, select.input-modern:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(255, 42, 133, 0.15);
}

select.input-modern option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.search-form {
    display: flex;
    gap: 12px;
    max-width: 700px;
    margin: 0 auto;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.search-input-wrapper input {
    padding-left: 2.8rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}
.btn-primary:hover {
    background: #e62074;
}

.btn-accent {
    background: var(--accent-secondary);
    color: #fff;
}
.btn-accent:hover {
    background: #ff4792;
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #1a964d;
}

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

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(255, 51, 51, 0.3);
}
.btn-danger-outline:hover {
    background: rgba(255, 51, 51, 0.1);
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

/* Login View */
.login-card {
    max-width: 420px;
    width: 100%;
    margin: 0;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-img {
    height: 70px;
    width: auto;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
}

/* Search View Centering */
#view-search .panel-card {
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

#view-search .view-header {
    margin-top: 2rem;
}

/* Search Results (Email lookup) */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.email-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.email-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.card-platform {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 1rem;
    padding: 4px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 20px;
    margin-bottom: 1rem;
}

.card-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card-subject {
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 500;
    margin-bottom: 1rem;
}

.code-display-area {
    background: var(--bg-card);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1rem;
}

.code-text {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    margin-bottom: 1rem;
    word-break: break-all;
}

.body-preview {
    background: var(--bg-input);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    border: 1px solid var(--border-color);
}

/* Status Messages & Spinners */
.status-message {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-height: 20px;
}
.status-message.error { color: var(--danger); }
.status-message.success { color: var(--success); }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 42, 133, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

/* Admin Grid Layout */
.admin-grid-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.span-full {
    grid-column: 1 / -1;
}

.form-side {
    grid-column: 1 / 2;
}

.table-side {
    grid-column: 2 / 3;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Whitelist Specific Layout */
.whitelist-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.checkbox-container input {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

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

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

.modern-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.modern-table th.text-right {
    text-align: right;
}

.modern-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
    vertical-align: middle;
}

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

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
}

.badge-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-status.active { background: rgba(32, 176, 91, 0.15); color: var(--success); }
.badge-status.inactive { background: rgba(255, 51, 51, 0.15); color: var(--danger); }

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .admin-grid-layout, .whitelist-layout {
        grid-template-columns: 1fr;
    }
    
    .form-side, .table-side {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
    }
    
    .sidebar-header {
        margin-bottom: 1rem;
    }
    
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .nav-item {
        width: auto;
        padding: 8px 12px;
    }
    
    .main-content {
        padding: 1.5rem 1rem;
    }
    
    .search-form {
        flex-direction: column;
    }
}
