/* --- MODERN UI REVAMP --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #f4f7fa;
    --bg-content: #ffffff;
    --bg-sidebar: #1f2937;
    --text-main: #111827;
    --text-light: #6b7280;
    --text-sidebar: #ffffff;
    --border-color: #e5e7eb;
    --hover-sidebar: #374151;
    --active-sidebar: #4b5563;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-blue: #667eea;
}

html.dark {
    --bg-main: #111827;
    --bg-content: #1f2937;
    --bg-sidebar: #0f172a;
    --text-main: #f9fafb;
    --text-light: #9ca3af;
    --text-sidebar: #f9fafb;
    --border-color: #374151;
    --hover-sidebar: #1e293b;
    --active-sidebar: #334155;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes subtle-pop {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}


.page-content-transition {
    animation: fadeIn 0.5s ease-out forwards;
}

/* --- Loader --- */
.loader-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* Sidebar & Navigation */
.sidebar {
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    transition: transform 0.3s ease-in-out;
}

.sidebar-closed {
    transform: translateX(-100%) !important;
}

.nav-link:hover {
    background-color: var(--hover-sidebar);
}

.nav-link.active {
    background-color: var(--active-sidebar);
    font-weight: 600;
}

/* Dashboard Cards */
.stat-card {
    background: var(--bg-content);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stat-card .icon-wrapper {
    padding: 1rem;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #fff;
}

/* User Card Grid */
#users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.user-card {
    background: var(--bg-content);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
}

.user-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.user-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
    border: 3px solid var(--accent-blue);
}

.user-card .status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    display: inline-block;
    margin-top: 0.5rem;
}

.user-card .status-badge.expired {
    background-color: #ef4444;
    /* Red */
}

/* General Components */
.card {
    background-color: var(--bg-content);
    border-color: var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.main-content {
    transition: margin-left 0.3s ease-in-out;
}

.header,
.table-container {
    border-color: var(--border-color);
}

/* Modals */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease;
}

#view-modal {
    z-index: 50;
}

#view-stock-modal {
    z-index: 55;
}

#sell-product-modal {
    z-index: 60;
}

#receive-payment-modal {
    z-index: 60;
}

#modal {
    z-index: 70;
}

#confirm-modal {
    z-index: 80;
}

.modal-content {
    background-color: var(--bg-content);
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s ease;
    animation: subtle-pop 0.3s ease-out forwards;
}

.modal-backdrop:not(.hidden) .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Toast Notification */
.toast {
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(20px);
    opacity: 0;
    z-index: 100;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--bg-content);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    flex-grow: 1;
    padding: 10px 0;
}

.nav-item.active i,
.nav-item.active span {
    color: var(--accent-blue);
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 12px;
}

/* Tabbed View Modal Styles */
#view-modal .modal-content,
#view-stock-modal .modal-content {
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 720px;
    padding: 0;
}

#view-modal #view-modal-content,
#view-stock-modal #view-stock-modal-content {
    overflow-y: auto;
    padding: 2rem;
}

.view-modal-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-blue);
}

.unpaid-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background-color: #10b981;
    /* Green */
}

.unpaid-badge.unpaid {
    background-color: #ef4444;
    /* Red */
}

.view-modal-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}


.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: var(--text-light);
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: var(--accent-blue);
    font-weight: 600;
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    padding-top: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.detail-item {
    background-color: var(--bg-main);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-item .label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.detail-item .value {
    font-size: 1rem;
    font-weight: 600;
}

.document-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.document-link:hover {
    text-decoration: underline;
}

/* --- Split Focus Form Styles --- */
.split-focus-form {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* 2/3 for primary, 1/3 for secondary */
    gap: 2rem;
}

.split-focus-form .primary-col,
.split-focus-form .secondary-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.split-focus-form .secondary-col {
    background-color: var(--bg-main);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.split-focus-form h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.split-focus-form .sub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Transaction Row Colors */
.transaction-inward {
    background-color: rgba(16, 185, 129, 0.1);
}

.transaction-outward {
    background-color: rgba(239, 68, 68, 0.1);
}

html.dark .transaction-inward {
    background-color: rgba(16, 185, 129, 0.2);
}

html.dark .transaction-outward {
    background-color: rgba(239, 68, 68, 0.2);
}