/* CSS Reset & Variables */
:root {
    --bg-dark: #0f0c29;
    --primary: #6366f1;
    /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #a1a1aa;

    --success: #10b981;
    --warning: #f59e0b;

    --font-family: 'Outfit', sans-serif;
    --ease-squish: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    position: relative;
}

/* Background Gradients */
.bg-gradient-1 {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    animation: float 10s ease-in-out infinite alternate;
}

.bg-gradient-2 {
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vh;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    animation: float 8s ease-in-out infinite alternate-reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 30px);
    }
}

#app-container {
    width: 100%;
    max-width: 1200px;
    padding: 1rem;
    position: relative;
}

/* UTILITIES */
.hidden {
    display: none !important;
}

/* GLASSMORPHISM CARD */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* LOGIN VIEW */
#login-view {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 3.5rem 2.5rem;
    /* Increased top/bottom padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ensures horizontal centering */
    text-align: center;
    animation: slideUp 0.6s var(--ease-squish);
}

.logo-area {
    margin-bottom: 3rem;
    /* Even more space before form */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    /* Removed the circular background styles */
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-area h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    /* Increased spacing between Title and Subtitle */
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.logo-area p {
    color: var(--text-muted);
    font-size: 1rem;
    letter-spacing: 0.5px;
}

/* FORMS */
.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.input-wrapper input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button.btn-primary {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

button.btn-primary:active {
    transform: scale(0.98);
}

.error-msg {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 1rem;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
}

/* DASHBOARD */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    margin-bottom: 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 700;
    font-size: 1.2rem;
}

.nav-logo {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 0 8px var(--primary-glow));
    border-radius: 4px;
    /* Optional slight rounding */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile span {
    font-weight: 500;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 2rem;
    font-weight: 600;
}

.date-display {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stats-grid.admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.charts-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .charts-split {
        grid-template-columns: 1fr;
    }
}

/* CHART */
.chart-container {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 4px;
}

/* TABLE STYLES */
.table-card {
    padding: 0;
    overflow: hidden;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.income {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-icon.bonus {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* TABLE */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
}

.table-container {
    padding: 1rem;
    overflow-x: auto;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.invoices-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
}

.invoices-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

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

.invoices-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-paid {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.btn-download {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-download:hover {
    background: var(--primary);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .glass-card {
        border-radius: 16px;
    }

    .stat-card {
        padding: 1.25rem;
    }
}

/* Skeleton Loader */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 37%, rgba(255, 255, 255, 0.05) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 4px;
    color: transparent !important;
}

.skeleton-text {
    height: 1em;
    width: 70%;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    min-height: 120px;
}

/* Error View Transition */
#error-view {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Custom Logo Styling */
.logo-custom {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 20px;
    mix-blend-mode: screen;
    /* Remove black background */
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-area {
    isolation: isolate;
    /* Ensure blend mode works */
}

/* ADMIN CALENDAR */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.cal-day-header {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

.cal-day {
    aspect-ratio: 1;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: default;
    transition: all 0.2s;
}

.cal-day:hover {
    background: rgba(255, 255, 255, 0.06);
}

.cal-day.has-payments {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.1);
    color: white;
    cursor: pointer;
}

.cal-day.today {
    border-color: var(--warning);
}

.payment-dots {
    display: flex;
    gap: 3px;
    margin-top: auto;
    flex-wrap: wrap;
}

.p-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.cal-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.cal-day:hover .cal-tooltip {
    opacity: 1;
}