/* ==========================================================================
   Parivar Suraksha Foundation (PSFWeb) - Global Theme & Stylesheet
   Theme Palette: Deep Emerald Teal (Inspired by Mobile App Theme)
   Layout: Modern Dashboard with Sidebar & Topbar (Inspired by Visitorz layout)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Variables
   -------------------------------------------------------------------------- */
:root {
    /* Primary Theme Palette (Deep Emerald Teal) */
    --primary-color: #1b7a73;
    --primary-hover: #145b56;
    --primary-active: #0f4642;
    --primary-light: #e8f4f3;
    --primary-gradient: linear-gradient(135deg, #1b7a73 0%, #269d95 100%);
    --primary-text: #ffffff;

    /* Secondary / Grey Palette */
    --grey-color: #6c757d;
    --grey-hover: #5a6268;
    --grey-light: #f8f9fa;
    --grey-border: #dce4e3;
    --grey-dark: #343a40;
    --grey-text: #495057;

    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;

    /* Sidebar Dark Theme (Teal Tinted Dark Navy) */
    --sidebar-bg: #122c2a;
    --sidebar-header-bg: #0b1d1c;
    --sidebar-hover: #1c4440;
    --sidebar-active: #1b7a73;
    --sidebar-text: #ffffff;          /* White color for non-active sidebar tabs */
    --sidebar-text-active: #ffffff;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;

    /* Surface & Background */
    --body-bg: #f4f7f6;
    --card-bg: #ffffff;
    --topbar-bg: #ffffff;

    /* Border Radius System */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Elevation / Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);

    /* Transitions */
    --transition: all 0.3s ease;
}

/* Dark Mode Variables Override */
[data-theme="dark"] {
    --body-bg: #12181b;
    --card-bg: #1a2226;
    --topbar-bg: #1a2226;
    --grey-border: #2d3740;
    --grey-text: #cbd5e1;
    --primary-light: #1c3634;
}

/* --------------------------------------------------------------------------
   2. General Reset & Typography
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--grey-text);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* --------------------------------------------------------------------------
   3. Main App Layout Structure (Sidebar + Main Header + Content)
   -------------------------------------------------------------------------- */
#app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* --- Sidebar --- */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    height: 70px;
    background: var(--sidebar-header-bg);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(27, 122, 115, 0.4);
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 15px 10px;
    list-style: none;
}

.sidebar-item {
    margin-bottom: 4px;
}

/* Sidebar Tab Link (White Color for Non-Active Tabs) */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: #ffffff !important;         /* Pure white text for non-active tabs */
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

.sidebar-link i {
    font-size: 1.2rem;
    width: 22px;
    text-align: center;
    color: #ffffff !important;         /* Pure white icons for non-active tabs */
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff !important;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active) !important;
    box-shadow: 0 4px 12px rgba(27, 122, 115, 0.35);
    font-weight: 600;
}

.sidebar-link.active i {
    color: #ffffff !important;
}

/* Sub-menu Arrow Indicator */
.submenu-arrow {
    margin-left: auto;
    font-size: 0.8rem !important;
    width: auto !important;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.85) !important;
}

.sidebar-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
    color: #ffffff !important;
}

/* --- Sub-Tab (Sub-Menu) Styling --- */
.submenu-list {
    list-style: none;
    padding: 6px 0 6px 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-left: 1px dashed rgba(255, 255, 255, 0.15);
    margin-left: 24px;
}

.submenu-item {
    position: relative;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: #ffffff !important;         /* Pure white text for sub-tabs */
    font-size: 0.88rem;
    font-weight: 400;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}

.submenu-link i {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85) !important;
}

.submenu-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff !important;
    border-left-color: rgba(255, 255, 255, 0.6);
}

.submenu-link.active {
    background: rgba(27, 122, 115, 0.45);
    color: #ffffff !important;
    font-weight: 600;
    border-left-color: var(--primary-color);
    box-shadow: inset 0 0 8px rgba(27, 122, 115, 0.25);
}

.submenu-link.active i {
    color: var(--primary-color) !important;
}

/* Collapsed Sidebar State */
#app-wrapper.collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

#app-wrapper.collapsed .sidebar-brand-text,
#app-wrapper.collapsed .sidebar-link span,
#app-wrapper.collapsed .submenu-arrow {
    display: none;
}

#app-wrapper.collapsed .submenu.show {
    display: none !important;
}

#app-wrapper.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
}

#app-wrapper.collapsed .sidebar-link {
    justify-content: center;
    padding: 14px 0;
}

/* --- Main Area Wrapper --- */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

#app-wrapper.collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* --- Top Header (Topbar) --- */
.topbar {
    height: 70px;
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid var(--grey-border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--grey-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-icon-btn {
    position: relative;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--grey-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--grey-border);
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(27, 122, 115, 0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--grey-dark);
}

.user-role {
    font-size: 0.75rem;
    color: var(--grey-color);
}

/* --- Main Content Body --- */
.main-content {
    flex: 1;
    padding: 25px;
}

.page-header-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--grey-dark);
}

.breadcrumb-nav {
    font-size: 0.85rem;
    color: var(--grey-color);
}

.breadcrumb-nav a {
    color: var(--grey-color);
}

.breadcrumb-nav a:hover {
    color: var(--primary-color);
}

/* --- Footer --- */
.app-footer {
    padding: 15px 25px;
    background: var(--topbar-bg);
    border-top: 1px solid var(--grey-border);
    text-align: right;
    font-size: 0.85rem;
    color: var(--grey-color);
}

/* --------------------------------------------------------------------------
   4. BUTTON CLASSES (Save Button, Back Button, Theme Buttons)
   -------------------------------------------------------------------------- */

/* Save Button (Primary Theme Color) */
.btn-save,
.btn-save-theme,
.btn-primary-theme {
    background: var(--primary-color);
    background-image: var(--primary-gradient);
    color: var(--primary-text) !important;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(27, 122, 115, 0.3);
    transition: var(--transition);
}

.btn-save:hover,
.btn-save-theme:hover,
.btn-primary-theme:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(27, 122, 115, 0.45);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-save:active,
.btn-save-theme:active,
.btn-primary-theme:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(27, 122, 115, 0.3);
}

/* Back Button (Grey Color) */
.btn-back,
.btn-back-theme,
.btn-secondary-theme {
    background: var(--grey-color);
    color: #ffffff !important;
    border: 1px solid var(--grey-color);
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.2);
    transition: var(--transition);
}

.btn-back:hover,
.btn-back-theme:hover,
.btn-secondary-theme:hover {
    background: var(--grey-hover);
    border-color: var(--grey-hover);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.35);
    transform: translateY(-1px);
}

.btn-back:active,
.btn-back-theme:active,
.btn-secondary-theme:active {
    transform: translateY(0);
}

/* Outline Variants */
.btn-outline-theme {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color) !important;
    padding: 9px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-theme:hover {
    background: var(--primary-color);
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   5. FORM CONTROLS (Inputs, Selects, Labels, Form Groups)
   -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--grey-dark);
    margin-bottom: 8px;
    display: block;
}

.form-control,
.form-select {
    width: 100%;
    padding: 11px 16px;
    font-size: 0.95rem;
    color: var(--grey-dark);
    background-color: #ffffff;
    border: 1.5px solid var(--grey-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    outline: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(27, 122, 115, 0.15);
    background-color: #ffffff;
}

.form-control::placeholder {
    color: #a0aec0;
}

/* Input with Icon Container (Inspired by mobile app UI) */
.input-icon-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-group i,
.input-icon-group .icon-badge {
    position: absolute;
    left: 14px;
    color: var(--primary-color);
    font-size: 1.1rem;
    pointer-events: none;
}

.input-icon-group .icon-badge {
    width: 34px;
    height: 34px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-icon-group .form-control {
    padding-left: 45px;
}

.input-icon-group.has-badge .form-control {
    padding-left: 58px;
}

/* --------------------------------------------------------------------------
   6. CARDS (Base Card, Form Card, Stat Cards)
   -------------------------------------------------------------------------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--grey-border);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: transparent;
    padding: 18px 24px;
    border-bottom: 1px solid var(--grey-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--grey-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary-color);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.01);
    border-top: 1px solid var(--grey-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Special Stat Card (Inspired by Visitorz Dashboard Top Cards) */
.stat-card {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--grey-border);
    box-shadow: var(--shadow-sm);
    gap: 18px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.88rem;
    color: var(--grey-color);
    font-weight: 600;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--grey-dark);
}

/* Banner Card / Curved Header (Inspired by Mobile App Create Bill header) */
.theme-header-banner {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 30px 25px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(27, 122, 115, 0.25);
}

.theme-header-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -40px;
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.theme-header-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.theme-header-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* --------------------------------------------------------------------------
   7. Responsive Layout Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    #app-wrapper.collapsed .app-sidebar {
        margin-left: 0;
        width: var(--sidebar-width);
    }
    
    #app-wrapper.collapsed .sidebar-brand-text,
    #app-wrapper.collapsed .sidebar-link span {
        display: inline;
    }
}






