:root {
    --bg-dark: #0f1115;
    --bg-card: #1c1f26;
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --border: #2d313a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.styled-input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #222;
    color: #fff;
    outline: none;
}

.styled-input:focus {
    border-color: var(--primary);
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.hidden {
    display: none !important;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-outline:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 20px;
}

.btn-text:hover {
    color: var(--text-main);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Login */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.login-box h2 {
    margin-bottom: 10px;
}

.login-box p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.error-msg {
    color: var(--danger) !important;
    margin-top: 15px;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar .logo {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 40px;
    color: white;
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-btn {
    background: transparent;
    border: none;
    text-align: left;
    padding: 12px;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-btn.logout {
    color: var(--danger);
    margin-top: auto;
}

.user-info {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

#admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

#admin-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Table */
.table-wrapper {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(255, 255, 255, 0.02);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
}

td {
    font-size: 0.9rem;
}

.product-img-mini {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #333;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-right: 5px;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.action-btn.delete {
    color: var(--danger);
}

.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Logs */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item {
    background: var(--bg-card);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-box {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    width: 600px;
    /* Wider for better layout */
    max-width: 90%;
    border: 1px solid var(--border);
    max-height: 90vh;
    /* Limit height */
    overflow-y: auto;
    /* Enable scrolling */
}

.modal-box h2 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 6px;
    color: #ffffff;
    /* Explicitly set white text */
}

.form-group select option {
    background: #222;
    color: white;
}

.form-group input:focus {
    outline: 1px solid var(--primary);
}

.row {
    display: flex;
    gap: 10px;
}

.row .form-group {
    flex: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: -30px;
    /* Stick to bottom */
    background: var(--bg-card);
    margin-bottom: -30px;
    /* Counteract padding */
    padding-bottom: 30px;
    z-index: 10;
}

/* Pricing Options Styles */
.option-row {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.option-row input {
    margin-bottom: 0 !important;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success);
}

input:checked+.slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}