/* --- 1. VARIABILE & RESET --- */
:root {
    --primary: #6366f1;       /* Indigo */
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --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), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    --radius: 12px;
    --sidebar-width: 260px;
}

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

body {
    background-color: #f1f5f9;
    color: var(--dark);
    height: 100vh;
    overflow: hidden; /* Previne scroll pe body, folosim scroll intern */
}

/* --- 2. LAYOUT PRINCIPAL --- */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- 3. SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100vh;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    flex-shrink: 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}
.logo h2 { font-size: 20px; font-weight: 700; color: white; letter-spacing: -0.5px; }
.logo i { font-size: 24px; }

.close-menu-btn { display: none; background: none; border: none; color: white; font-size: 20px; cursor: pointer; }

/* Navigatie */
.sidebar nav ul { list-style: none; }

.nav-item {
    padding: 14px 16px;
    cursor: pointer;
    border-radius: var(--radius);
    margin-bottom: 8px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover { background-color: rgba(255,255,255, 0.05); color: var(--white); }
.nav-item.active { background-color: var(--primary); color: white; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.nav-item i { margin-right: 14px; width: 20px; text-align: center; }

.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; }
.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.logout-btn:hover { background-color: rgba(239, 68, 68, 0.1); }

/* --- 4. CONTINUT PRINCIPAL --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Scroll doar in interiorul continutului */
    position: relative;
    width: 100%;
}

/* Header de sus */
.top-bar {
    padding: 20px 30px;
    background: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    height: 80px;
    flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-left h1 { font-size: 20px; font-weight: 600; }
.menu-btn { display: none; background: none; border: none; font-size: 24px; color: var(--secondary); cursor: pointer; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--light);
    padding: 6px 12px;
    border-radius: 50px;
    border: 1px solid var(--border);
}
.avatar {
    width: 32px; height: 32px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
}
.user-name { font-size: 14px; font-weight: 600; color: var(--dark); }

/* Zonele de continut (Tabs) */
.tab-content {
    display: none;
    padding: 30px;
    overflow-y: auto;
    height: calc(100% - 80px);
    animation: fadeIn 0.3s ease;
}
.tab-content.active-tab { display: block; }

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

/* --- 5. COMPONENTE UI --- */

/* Carduri Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-balance .amount { color: var(--success); font-size: 28px; font-weight: 800; }
.card-pending .amount { color: var(--warning); font-size: 28px; font-weight: 800; }

.card-icon {
    width: 40px; height: 40px;
    background-color: var(--light);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 18px;
}

/* Butoane */
.btn-primary-large {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary-large:hover { background-color: var(--primary-dark); }

.btn-secondary {
    background: var(--white); border: 1px solid var(--border); color: var(--secondary);
    padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 500;
}

/* Tabele Responsive */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

.table-responsive {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--light); }
th { background-color: #f8fafc; font-size: 12px; text-transform: uppercase; color: var(--secondary); font-weight: 600; letter-spacing: 0.5px; }
td { font-size: 14px; color: #334155; }
tr:last-child td { border-bottom: none; }
tr:hover { background-color: #fcfcfc; }

/* Badges */
.badge { padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; display: inline-block; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.failed { background: #fee2e2; color: #991b1b; }

/* Formular */
.form-container { max-width: 500px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--secondary); }
.form-group input, .form-group select {
    width: 100%; padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* --- 6. OVERLAY SI MOBILE --- */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    z-index: 40;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.overlay.active { display: block; opacity: 1; }

/* Butoane mici */
.action-btn {
    padding: 6px 10px; border-radius: 6px; border: none; cursor: pointer; font-size: 12px; margin-right: 4px; transition: 0.2s;
}
.btn-view { background: #f1f5f9; color: var(--dark); }
.btn-block { background: #fffbeb; color: #b45309; }
.btn-del { background: #fef2f2; color: #b91c1c; }
.btn-view:hover { background: #e2e8f0; }

/* --- 7. MEDIA QUERIES (RESPONSIVE) --- */

@media (max-width: 1024px) {
    /* Tablet & Small Laptop */
    .sidebar { width: 220px; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .card-action { grid-column: span 2; } /* Cardul de actiune ocupa tot randul */
}

@media (max-width: 768px) {
    /* Mobile */
    .sidebar {
        position: fixed;
        left: -280px; /* Ascuns complet */
        width: 280px;
        box-shadow: 20px 0 20px rgba(0,0,0,0.1);
    }
    
    .sidebar.active { transform: translateX(280px); }
    .close-menu-btn { display: block; }
    .menu-btn { display: block; }
    
    .main-content { padding: 0; width: 100%; }
    .top-bar { padding: 15px; }
    
    .cards-grid { grid-template-columns: 1fr; }
    .card-action { grid-column: span 1; }
    
    .tab-content { padding: 15px; }
    
    h1 { font-size: 18px; }
    .user-name { display: none; } /* Ascundem numele pe mobil, lasam doar avatar */
}
