/* =====================================================
   Lush Oasis Water ERP - Main Stylesheet
   ===================================================== */

:root {
    --pm-primary: #1e7c4d;
    --pm-primary-light: #2fae74;
    --pm-primary-dark: #0f4d2e;
    --pm-accent: #1a1a1a;
    --pm-sidebar-bg: #0b2e1c;
    --pm-sidebar-bg-2: #0f4d2e;
    --pm-sidebar-hover: #17603a;
    --pm-bg: #f3f6f5;
    --pm-card-radius: 0.85rem;
    --pm-radius-sm: 0.55rem;
    --pm-text-muted: #6b7280;
    --pm-text: #212a26;
    --pm-danger: #d62b30;
    --pm-success: #1a9e5c;
    --pm-warning: #e0a82e;
    --pm-info: #2f7dbf;
    --pm-purple: #7c4fd0;
    --pm-border: #e7ebe9;
    --pm-shadow-sm: 0 1px 2px rgba(15, 40, 25, 0.06);
    --pm-shadow-md: 0 6px 20px rgba(15, 40, 25, 0.08);
    --pm-shadow-lg: 0 16px 40px rgba(15, 40, 25, 0.14);
}

* { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

body {
    background-color: var(--pm-bg);
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--pm-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -0.01em; }

a { transition: color 0.15s ease; }

/* ===== Login Page ===== */
.login-body {
    background:
        radial-gradient(circle at 15% 15%, rgba(255,255,255,0.08), transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(255,255,255,0.06), transparent 40%),
        linear-gradient(135deg, var(--pm-primary-dark), var(--pm-primary) 60%, var(--pm-primary-light));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
    background: #fff;
    border-radius: 1.1rem;
    padding: 2.6rem 2.2rem;
    box-shadow: var(--pm-shadow-lg);
    animation: pmFadeUp 0.4s ease;
}
.login-brand { text-align: center; margin-bottom: 1.6rem; }
.login-brand i { font-size: 2.5rem; color: var(--pm-primary); }
.login-logo { max-width: 150px; max-height: 150px; margin-bottom: 0.6rem; filter: drop-shadow(0 6px 14px rgba(15,77,46,0.25)); }
.login-brand h1 { font-size: 1.9rem; font-weight: 750; color: var(--pm-primary-dark); margin: 0.3rem 0 0; letter-spacing: -0.02em; }
.login-brand p { color: var(--pm-text-muted); font-size: 0.85rem; margin: 0; }
.login-card .form-label { font-weight: 600; font-size: 0.85rem; color: var(--pm-text); }
.login-card .input-group-text { background: #f6f8f7; border-right: none; color: var(--pm-primary); }
.login-card .form-control { border-left: none; }
.login-card .input-group:focus-within .input-group-text,
.login-card .input-group:focus-within .form-control { border-color: var(--pm-primary); box-shadow: none; }
.login-btn {
    background: linear-gradient(135deg, var(--pm-primary), var(--pm-primary-dark));
    border: none;
    padding: 0.7rem;
    font-weight: 650;
    border-radius: var(--pm-radius-sm);
    box-shadow: 0 8px 20px rgba(15,77,46,0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(15,77,46,0.32); background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-primary-dark)); }
.login-footer { text-align: center; margin-top: 1.6rem; font-size: 0.75rem; color: var(--pm-text-muted); }
.password-toggle { cursor: pointer; background: #f6f8f7; }
.password-toggle:hover { color: var(--pm-primary); }

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

/* ===== App Layout ===== */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--pm-sidebar-bg), var(--pm-sidebar-bg-2) 140%);
    color: #e8efe9;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: margin-left 0.25s ease;
    z-index: 1000;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.3rem 1.2rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand i { color: var(--pm-accent); font-size: 1.4rem; }
.sidebar-logo {
    height: 40px;
    width: 40px;
    object-fit: cover;
    border-radius: 0.6rem;
    background: #fff;
    padding: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.sidebar-menu { list-style: none; padding: 0.6rem 0.6rem; margin: 0; }
.sidebar-menu .sidebar-group-label {
    padding: 0.9rem 0.6rem 0.35rem;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(232,239,233,0.4);
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    color: #cfe0d4;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 0.55rem;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.sidebar-menu li a i { width: 18px; text-align: center; opacity: 0.85; }
.sidebar-menu li a:hover { background: var(--pm-sidebar-hover); color: #fff; }
.sidebar-menu li.active a {
    background: linear-gradient(135deg, var(--pm-primary), var(--pm-primary-light));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.sidebar-menu li.active a i { opacity: 1; }
.sidebar-menu li.border-top { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 0.4rem; padding-top: 0.5rem; }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--pm-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--pm-shadow-sm);
}
.topbar-title { font-weight: 650; color: var(--pm-primary-dark); }
.topbar-right { display: flex; align-items: center; font-size: 0.9rem; color: var(--pm-text-muted); }
.topbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pm-primary), var(--pm-primary-dark));
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.4rem;
}
.role-badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    text-transform: uppercase;
    vertical-align: middle;
}
.role-badge.admin { background: var(--pm-primary-dark); color: #fff; }
.role-badge.manager { background: var(--pm-info); color: #fff; }
.role-badge.employee { background: var(--pm-purple); color: #fff; }

.page-content { padding: 1.5rem; flex: 1; animation: pmFadeUp 0.25s ease; }

/* ===== Cards ===== */
.stat-card {
    background: #fff;
    border-radius: var(--pm-card-radius);
    padding: 1.15rem 1.35rem;
    box-shadow: var(--pm-shadow-sm);
    border: 1px solid var(--pm-border);
    border-left: 4px solid var(--pm-primary);
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--pm-shadow-md); }
.stat-card .stat-label { font-size: 0.76rem; color: var(--pm-text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-card .stat-value { font-size: 1.55rem; font-weight: 750; color: #1f2a25; margin-top: 0.25rem; letter-spacing: -0.01em; }
.stat-card .stat-value a { color: var(--pm-primary-dark); text-decoration: none; font-weight: 600; }
.stat-card .stat-value a:hover { color: var(--pm-accent); text-decoration: underline; }
.stat-card .stat-icon { font-size: 1.8rem; opacity: 0.15; position: absolute; right: 1.2rem; top: 1.1rem; }
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(30,124,77,0.05), transparent 60%);
    pointer-events: none;
}
.stat-card.success { border-left-color: var(--pm-success); }
.stat-card.warning { border-left-color: var(--pm-warning); }
.stat-card.danger { border-left-color: var(--pm-danger); }
.stat-card.info { border-left-color: var(--pm-info); }
.stat-card.purple { border-left-color: var(--pm-purple); }
.stat-card.purple .stat-icon { color: var(--pm-purple); }

.content-card {
    background: #fff;
    border-radius: var(--pm-card-radius);
    box-shadow: var(--pm-shadow-sm);
    border: 1px solid var(--pm-border);
    padding: 1.35rem;
    margin-bottom: 1.5rem;
}
.content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--pm-border);
    padding-bottom: 0.9rem;
}
.content-card-header h5 { margin: 0; font-weight: 650; color: var(--pm-primary-dark); }
.content-card-header h5 i { color: var(--pm-primary); margin-right: 0.35rem; }
.content-card h6 { font-weight: 650; color: var(--pm-primary-dark); }

/* Section labels used to group related modules in tables/forms */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pm-text-muted);
    margin: 0.4rem 0 0.2rem;
}
.badge-soft-purple { background: var(--pm-purple); color: #fff; }

/* ===== Tables ===== */
.table-responsive { border-radius: var(--pm-radius-sm); overflow: hidden; }
table.pm-table thead { background: var(--pm-primary-dark); color: #fff; }
table.pm-table thead th { border: none; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; vertical-align: middle; }
table.pm-table tbody tr { transition: background 0.12s ease; }
table.pm-table tbody tr:hover { background: #eef6f1; }
table.pm-table td, table.pm-table th { padding: 0.75rem 0.9rem; vertical-align: middle; }
table.pm-table tbody tr:nth-child(even) { background: #fbfcfb; }
table.pm-table tbody tr:nth-child(even):hover { background: #eef6f1; }

.badge { font-weight: 600; letter-spacing: 0.02em; padding: 0.38em 0.65em; border-radius: 0.4rem; }
.badge-stock-low { background: var(--pm-warning); color: #fff; }
.badge-stock-out { background: var(--pm-danger); color: #fff; }
.badge-stock-ok { background: var(--pm-success); color: #fff; }

/* ===== Buttons ===== */
.btn { border-radius: var(--pm-radius-sm); font-weight: 550; transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease; }
.btn:active { transform: translateY(1px); }
.btn-pm-primary { background-color: var(--pm-primary); border-color: var(--pm-primary); color: #fff; }
.btn-pm-primary:hover { background-color: var(--pm-primary-dark); border-color: var(--pm-primary-dark); color: #fff; box-shadow: 0 4px 12px rgba(15,77,46,0.25); }
.btn-sm { border-radius: 0.45rem; }

.form-control, .form-select { border-radius: 0.5rem; border-color: #dde3e0; }
.form-control:focus, .form-select:focus { border-color: var(--pm-primary); box-shadow: 0 0 0 0.2rem rgba(30,124,77,0.12); }
.form-label { font-weight: 600; font-size: 0.85rem; color: var(--pm-text); }

/* ===== Misc ===== */
.alert-card-list .alert { margin-bottom: 0.6rem; }
.alert { border-radius: var(--pm-radius-sm); border: none; box-shadow: var(--pm-shadow-sm); }
.chart-card { background: #fff; border-radius: var(--pm-card-radius); padding: 1.2rem; box-shadow: var(--pm-shadow-sm); border: 1px solid var(--pm-border); height: 100%; }
.chart-card h6 { font-weight: 650; color: var(--pm-primary-dark); margin-bottom: 1rem; }

.invoice-box { background: #fff; padding: 2rem; border-radius: 0.6rem; }
.invoice-box .company-block h3 { color: var(--pm-primary-dark); font-weight: 700; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--pm-text-muted); }
.empty-state i { font-size: 2.2rem; opacity: 0.3; margin-bottom: 0.6rem; display: block; }

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { width: 100%; }
    .page-content { padding: 0; animation: none; }
    .content-card, .stat-card { box-shadow: none; border: 1px solid #ddd; }
}

@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: 0; margin-left: -250px; }
    .sidebar.show { margin-left: 0; }
}
