/* CSS Variables & Theme */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f8fafc;
    --dark: #1e293b;
    --white: #ffffff;
    --border: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: #f1f5f9;
    color: var(--dark);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(195deg, #1e293b 0%, #0f172a 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 30px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand i { font-size: 24px; color: var(--primary); }
.brand h2 { font-size: 20px; font-weight: 600; }

.nav-links {
    list-style: none;
    margin-top: 20px;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    color: #94a3b8;
}

.nav-links li:hover, .nav-links li.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.nav-links li.active {
    background: var(--primary);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
}

.nav-links li i { width: 20px; text-align: center; }

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--warning);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--dark);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

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

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

.section-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 16px;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(79, 70, 229, 0.4); }

.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-outline { border: 1px solid var(--border); background: transparent; color: var(--dark); }
.btn-outline:hover { background: var(--light); }

/* Forms & Inputs */
.search-box {
    position: relative;
    width: 300px;
}
.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.search-box input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1); }

/* Filters */
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    background: var(--white);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    width: fit-content;
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: #64748b;
    cursor: pointer;
    font-weight: 500;
}

.filter-btn.active {
    background: var(--light);
    color: var(--primary);
}

.vr {
    width: 1px;
    height: 24px;
    background: var(--border);
}

select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--white);
}

/* Cards Grid (Accounts) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.account-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid transparent;
}
.account-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.account-card.border-green { border-top-color: var(--success); }
.account-card.border-blue { border-top-color: var(--primary); }
.account-card.border-orange { border-top-color: var(--warning); }

.card-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--light);
}

.provider-info { display: flex; gap: 12px; }
.flag { font-size: 24px; }
.card-header h4 { font-size: 16px; margin-bottom: 2px; }
.card-header small { color: #64748b; }

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.blue { background: #e0e7ff; color: #3730a3; }
.badge.orange { background: #fef3c7; color: #92400e; }

.card-body { padding: 20px; }

.detail-row {
    margin-bottom: 12px;
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.1s;
}
.detail-row:hover { background: #f8fafc; }

.detail-row label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.detail-row .value {
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--dark);
}
.detail-row .value i { color: #cbd5e1; font-size: 14px; }
.detail-row:hover .value i { color: var(--primary); }
.detail-row .value.text-success i { color: var(--success); }

.tag {
    display: inline-block;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #475569;
}

/* Email Section */
.email-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

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

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #475569;
}

input, textarea, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 14px;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.variables-help { 
    margin-top: -10px; 
    margin-bottom: 20px; 
    color: #64748b; 
}

.list-group { display: flex; flex-direction: column; gap: 10px; }
.history-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius-md);
}
.history-item .icon { font-size: 18px; }

/* Sales Section */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}
.bg-indigo { background: var(--primary); }
.bg-green { background: var(--success); }
.bg-amber { background: var(--warning); }
.bg-red { background: var(--danger); }

.stat-card .info h3 { font-size: 14px; color: #64748b; font-weight: 500; }
.stat-card .info p { font-size: 24px; font-weight: 700; color: var(--dark); }

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

.sales-table th, .sales-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.sales-table th { color: #64748b; font-weight: 600; font-size: 13px; text-transform: uppercase; }
.sales-table tr:last-child td { border-bottom: none; }
.sales-table .amount { font-family: 'Courier New', Courier, monospace; font-weight: 700; }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-completed { background: #dcfce7; color: #166534; }
.status-processing { background: #e0e7ff; color: #3730a3; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}
.settings-card h3 { 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    color: var(--primary);
}

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-danger { background: var(--danger); }
.toast-warning { background: var(--warning); color: black; }

.fade-out { opacity: 0; transition: opacity 0.5s; }

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

/* Spinner */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 0;
    width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.close-modal { font-size: 24px; cursor: pointer; color: #94a3b8; }
.close-modal:hover { color: var(--danger); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .email-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; height: auto; overflow: visible; }
    .sidebar { width: 100%; }
    .nav-links li { display: inline-flex; margin-right: 10px; }
    .nav-links { display: flex; flex-wrap: wrap; }
    .main-content { padding: 15px; }
    .cards-grid { grid-template-columns: 1fr; }
    .stats-cards { grid-template-columns: 1fr; }
}

/* Demo Banner */
.demo-banner {
    background-color: #fef3c7;
    color: #92400e;
    padding: 12px 20px;
    text-align: center;
    border-bottom: 1px solid #fcd34d;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.demo-banner a {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
}

.demo-banner button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #92400e;
    cursor: pointer;
    padding: 0 5px;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-card .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--primary);
    margin-bottom: 20px;
}
.login-card h3 { margin-bottom: 10px; color: var(--dark); font-size: 20px; }
.login-card p { margin-bottom: 30px; color: #64748b; font-size: 14px; }
.login-card input {
    margin-bottom: 20px;
    padding: 12px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
}

.btn-block { width: 100%; padding: 12px; font-size: 16px; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
