@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --bg-color: #F3F4F6;
    --card-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 40% 20%, hsla(28,100%,74%,1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189,100%,56%,1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355,100%,93%,1) 0px, transparent 50%),
        radial-gradient(at 80% 50%, hsla(340,100%,76%,1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(22,100%,77%,1) 0px, transparent 50%),
        radial-gradient(at 80% 100%, hsla(242,100%,70%,1) 0px, transparent 50%),
        radial-gradient(at 0% 0%, hsla(343,100%,76%,1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
}

/* Glassmorphism Card Utility */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    padding: 24px;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
}
.sidebar .logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
}
.sidebar-link:hover, .sidebar-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 32px;
    flex: 1;
    min-height: 100vh;
}

/* Header & Typography */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
h1, h2, h3 { color: var(--text-main); font-weight: 600; }
h1 { font-size: 28px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}
.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: #F9FAFB;
}
.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #DC2626;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}
th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tr { transition: background 0.2s ease; }
tr:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.badge.Paid { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge.Unpaid { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge.Partial { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

/* Forms */
.form-group {
    margin-bottom: 20px;
}
label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    outline: none;
    font-family: 'Outfit', sans-serif;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: white;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 24px; }

/* Utilities */
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Mobile Responsiveness (PWA/App Layout) */
@media (max-width: 768px) {
    /* Bottom Navigation Bar */
    .sidebar {
        width: 100%;
        height: 70px !important;
        position: fixed;
        bottom: 0;
        left: 0;
        margin: 0 !important;
        padding: 10px 16px !important;
        border-radius: 20px 20px 0 0;
        z-index: 1000;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
    }
    .sidebar .logo {
        display: none; /* Hide text logo on mobile */
    }

    .nav-menu {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        align-items: center;
    }
    .sidebar-link {
        flex-direction: column;
        padding: 4px 8px;
        gap: 4px;
        font-size: 11px; /* Smaller text */
        background: transparent !important;
        color: var(--text-muted) !important;
        box-shadow: none !important;
    }
    .sidebar-link.active {
        color: var(--primary) !important;
    }
    .sidebar-link.active i {
        color: var(--primary) !important;
    }
    .sidebar-link i {
        width: 22px;
        height: 22px;
    }
    
    .logout-container {
        margin: 0 !important;
        padding: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .logout-link {
        margin-bottom: 0 !important;
        color: var(--danger) !important;
    }
    .logout-link i {
        color: var(--danger) !important;
    }
    
    .developer-credit {
        display: none !important;
    }
    
    /* Fix for right-side cut-off / horizontal scroll */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Main Content Area */
    .main-content {
        margin-left: 0 !important;
        padding: 12px !important;
        padding-bottom: 80px !important; /* Leave space for bottom nav */
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        overflow-x: hidden;
    }
    
    .glass-panel {
        padding: 16px !important;
    }
    
    /* Headers & Text */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 16px;
    }
    h1 { font-size: 24px; }
    
    /* Collapsing Grids */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    .grid-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px;
    }
    .grid-4 .glass-panel {
        padding: 10px 8px !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 4px !important;
        flex-wrap: wrap;
    }
    .grid-4 h2 {
        font-size: 18px !important;
        text-align: right !important;
        margin: 0 !important;
    }
    .grid-4 span {
        font-size: 10px !important;
    }
    .grid-4 i {
        width: 14px;
        height: 14px;
    }
    /* Reduce icon padding to save space */
    .grid-4 .glass-panel > div:first-child > div {
        padding: 6px !important;
    }
    
    /* Tables */
    .table-container {
        padding-bottom: 8px;
    }
    th, td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Flex Utilities Override */
    .justify-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .justify-between > div {
        width: 100% !important;
        text-align: left !important;
    }
}
