* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --light: #f1f5f9;
    --white: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gradient: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    --gradient-accent: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 20px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-left: 260px;
}

.topbar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.topbar-user:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary-light);
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.topbar-user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--dark);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--dark);
    padding: 24px 0;
    overflow-y: auto;
    z-index: 101;
}

.sidebar-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.sidebar-brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 800;
    font-size: 20px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.sidebar-brand-icon svg {
    width: 22px;
    height: 22px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    margin: 4px 12px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transform: translateX(4px);
}

.sidebar-nav-link.active {
    background: var(--gradient);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.sidebar-nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.sidebar-nav-link:hover .sidebar-nav-icon,
.sidebar-nav-link.active .sidebar-nav-icon {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    margin-top: 64px;
    padding: 32px;
    min-height: calc(100vh - 64px);
    background: linear-gradient(180deg, var(--light) 0%, var(--white) 100%);
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .topbar-logo {
        margin-left: 0;
    }

    .main-content {
        margin-left: 0;
    }
}

/* Dashboard */
.dashboard {
    max-width: 1400px;
}

.dashboard-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 24px;
}

/* Cards Row */
.cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

/* Dashboard Card */
.dashboard-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.1);
    transform: translateY(-5px);
}

/* Full Width Card */
.card-full {
    grid-column: 1 / -1;
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.card-icon.clients {
    background: var(--gradient);
}

.card-icon.subscriptions {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.card-icon.charges {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
}

.card-icon.recovery {
    background: linear-gradient(135deg, var(--accent) 0%, #fbbf24 100%);
}

.card-icon.invoices {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.card-icon.transactions {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    flex: 1;
}

/* Card Content */
.card-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Stat Row */
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--light);
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-label {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

.stat-value-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

/* Text Colors */
.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.tag-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tag-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.tag-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.tag-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: var(--gradient);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

/* Coming Soon */
.coming-soon-badge {
    background: var(--gradient);
    color: white;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.coming-soon-card {
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.coming-soon-card .card-icon {
    opacity: 0.6;
}

.coming-soon-content {
    padding: 16px 0 0;
}

.coming-soon-content p {
    color: var(--gray-light);
    font-size: 14px;
    line-height: 1.7;
}

/* Section Headers */
.section-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Inputs */
.input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input::placeholder {
    color: var(--gray-light);
}

/* Tables */
.table-container {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

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

.table th {
    background: var(--light);
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--light);
    font-size: 14px;
    color: var(--dark);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(99, 102, 241, 0.02);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--light);
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--primary);
    color: var(--white);
}

/* Responsive */
@media (max-width: 1024px) {
    .cards-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cards-row:first-of-type .dashboard-card:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .cards-row {
        grid-template-columns: 1fr;
    }
    
    .cards-row:first-of-type .dashboard-card:last-child {
        grid-column: auto;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Utility Classes */
.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-primary {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.rounded-full {
    border-radius: 50px;
}
