:root {
    /* Color Palette - Premium Dark */
    --bg-main: #0B0C10;
    --bg-surface: #1F2833;
    --bg-surface-elevated: #283340;
    
    --text-primary: #FFFFFF;
    --text-secondary: #C5C6C7;
    
    --accent-primary: #45A29E;
    --accent-secondary: #66FCF1;
    
    --status-green: #2ecc71;
    --status-green-glow: rgba(46, 204, 113, 0.2);
    --status-yellow: #f1c40f;
    --status-yellow-glow: rgba(241, 196, 15, 0.2);
    --status-red: #e74c3c;
    --status-red-glow: rgba(231, 76, 60, 0.2);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(31, 40, 51, 0.6);
    --glass-border: rgba(102, 252, 241, 0.15);
    
    --transition: all 0.3s ease;
}

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

body.dark-theme {
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 { color: var(--text-primary); font-weight: 600; }
a { color: var(--accent-secondary); text-decoration: none; }
.hint { font-size: 0.8rem; color: var(--text-secondary); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.d-block { display: block; }
.text-danger { color: var(--status-red); }

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

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 24px;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item i {
    width: 24px;
    margin-right: 10px;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(255,255,255,0.03);
    color: var(--accent-secondary);
}
.nav-item.active {
    border-left-color: var(--accent-secondary);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    max-height: 100vh;
    overflow-y: auto;
}

.top-header {
    background: var(--bg-surface);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    width: 400px;
}
.search-bar i { color: var(--text-secondary); margin-right: 10px; }
.search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
    outline: none;
}

/* View Sections */
.view-section {
    padding: 32px;
    animation: fadeIn 0.4s ease;
}

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

.page-title {
    margin-bottom: 24px;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
}

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

.stat-card {
    background: var(--bg-surface);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 10px;
}

.stat-card.green-glow { border-bottom: 3px solid var(--status-green); }
.stat-card.green-glow .stat-value { color: var(--status-green); }
.stat-card.yellow-glow { border-bottom: 3px solid var(--status-yellow); }
.stat-card.yellow-glow .stat-value { color: var(--status-yellow); }
.stat-card.red-glow { border-bottom: 3px solid var(--status-red); }
.stat-card.red-glow .stat-value { color: var(--status-red); }
.stat-card.highlight { border-bottom: 3px solid var(--accent-primary); }
.stat-card.highlight .stat-value { color: var(--accent-secondary); }

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
}

.tab-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--bg-main);
    border-color: var(--accent-primary);
}

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

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    text-align: left;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    background: var(--bg-surface);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-surface-elevated);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.data-table td {
    padding: 16px;
}

.data-table tbody tr td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.data-table tbody tr td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

/* Status Indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-green { background: var(--status-green-glow); color: var(--status-green); }
.status-yellow { background: var(--status-yellow-glow); color: var(--status-yellow); }
.status-red { background: var(--status-red-glow); color: var(--status-red); }

/* Table Row Borders based on status */
tr.row-green { border-left: 4px solid var(--status-green); }
tr.row-yellow { border-left: 4px solid var(--status-yellow); }
tr.row-red { border-left: 4px solid var(--status-red); }
tr.row-gray { border-left: 4px solid var(--text-secondary); }

/* Action Buttons inside Table */
.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    margin-right: 10px;
    transition: var(--transition);
}
.action-btn:hover { color: var(--text-primary); }
.btn-renew:hover { color: var(--status-green); }
.btn-dm:hover { color: #E1306C; } /* Instagram pink */
.btn-delete:hover { color: var(--status-red); }

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

.btn-primary { background: var(--accent-primary); color: #000; }
.btn-primary:hover { background: var(--accent-secondary); box-shadow: 0 0 15px rgba(102, 252, 241, 0.4); }

.btn-secondary { background: var(--bg-surface-elevated); color: #fff; border: 1px solid var(--border-color); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-danger { background: rgba(231, 76, 60, 0.1); color: var(--status-red); border: 1px solid var(--status-red); }
.btn-danger:hover { background: var(--status-red); color: #fff; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-surface);
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
    animation: zoomIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}
.close-modal:hover { color: var(--status-red); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { ddisplay: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.form-control {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    outline: none;
    transition: var(--transition);
}
.form-control:focus { border-color: var(--accent-secondary); background: rgba(0,0,0,0.4); }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 15px; }
.col { flex: 1; }

.payment-group {
    background: rgba(255,255,255,0.02);
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}
.payment-group h4 { margin-bottom: 15px; font-size: 1rem; color: var(--accent-secondary); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Settings Specific */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}
.settings-card h3 { margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.input-with-button { display: flex; gap: 10px; }
.managed-list { list-style: none; }
.managed-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    margin-bottom: 5px;
    border-radius: 6px;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-surface-elevated);
    border-left: 4px solid var(--accent-primary);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease forwards;
    min-width: 250px;
}

.toast.success { border-left-color: var(--status-green); }
.toast.error { border-left-color: var(--status-red); }
.toast.warning { border-left-color: var(--status-yellow); }

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

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

/* Responsive */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: space-between; border-right: none; border-bottom: 1px solid var(--border-color); }
    .sidebar-header { border-bottom: none; }
    .sidebar-nav { display: flex; overflow-x: auto; padding: 10px; }
    .nav-item { padding: 10px; border-left: none; border-bottom: 3px solid transparent; }
    .nav-item.active { border-left: none; border-bottom-color: var(--accent-secondary); }
    .sidebar-footer { display: none; }
    .row { flex-direction: column; }
    .search-bar { width: 100%; margin-bottom: 10px; }
    .top-header { flex-direction: column; align-items: stretch; }
    .header-actions { align-self: flex-end; }
}
