/* 
 * Mandatag Billing Platform 
 * Centralized Design System (v1.0.0)
 */

:root {
    --bg-dark: #0f172a;
    --bg-light: #f8fafc;
    --primary: #0f172a;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --card-bg: #ffffff;
    --glass: rgba(30, 41, 59, 0.7);
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --text-white: #f8fafc;
    --border: #e2e8f0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header & Navigation */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand img {
    height: 32px;
    width: auto;
}

h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 0; }

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-title { 
    font-size: 0.875rem; 
    color: var(--text-muted); 
    margin-bottom: 0.5rem; 
}

.card-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th { 
    background: #f1f5f9; 
    font-weight: 600; 
    color: var(--text-muted); 
}

/* Ecosystem Switcher UI */
.ecosystem-switcher {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.ecosystem-switcher:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--primary); }

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

.sidebar {
    width: 240px;
    background: #0f172a;
    color: white;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 2rem 3rem;
    background: #f8fafc;
    min-width: 0; /* Prevent flex overflow */
}

/* --- User Dropdown --- */
.user-menu {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    min-width: 200px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-radius: 0.75rem;
    padding: 0.5rem;
    z-index: 200;
    border: 1px solid #e2e8f0;
}

.user-menu:hover .dropdown-content {
    display: block;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--primary);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.dropdown-link:hover {
    background: #f1f5f9;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

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

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

/* --- Advanced Statistics --- */
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.trend-up { color: #10b981; font-size: 0.875rem; font-weight: 600; }
.trend-down { color: #ef4444; font-size: 0.875rem; font-weight: 600; }

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    margin-top: 2rem;
}

/* Login Interface (Specific Overlay) */
.auth-body {
    background: #0f172a;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0, transparent 50%), 
        radial-gradient(at 50% 0%, rgba(99, 102, 241, 0.15) 0, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(244, 63, 94, 0.1) 0, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    margin: 0;
    font-family: 'Outfit', sans-serif;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    padding: 3.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-white);
    text-align: center;
}

.login-card .logo img {
    height: 56px;
    width: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.3));
}

.login-card h1 { 
    font-size: 1.75rem; 
    font-weight: 700; 
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card .subtitle { 
    color: #94a3b8; 
    font-size: 0.875rem; 
    margin-top: 0.5rem; 
    margin-bottom: 2.5rem;
    font-weight: 500;
}

.login-card .form-group { text-align: left; margin-bottom: 1.75rem; }
.login-card label { 
    display: block; 
    margin-bottom: 0.75rem; 
    font-size: 0.7rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    color: #6366f1;
}

.login-card input { 
    width: 100%; 
    padding: 1rem 1.25rem; 
    background: rgba(255,255,255,0.03); 
    border: 1px solid rgba(255,255,255,0.08); 
    border-radius: 1rem; 
    color: white; 
    outline: none;
    transition: all 0.3s;
    font-size: 1rem;
}

.login-card input:focus { 
    border-color: #6366f1; 
    background: rgba(255,255,255,0.07); 
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.btn-submit {
    width: 100%;
    padding: 1.125rem;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    margin-top: 1rem;
}

.btn-submit:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.4);
    filter: brightness(1.1);
}

.login-card .footer {
    margin-top: 2.5rem;
    font-size: 0.75rem;
    color: #475569;
}

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