/*
 * 360 KPI Tracker - Custom Style Sheet
 * Theme: Light Theme (Purple, Teal, Green, Orange accents)
 * Layout Structure: Left Sidebar (White), Top Header (White), Gray workspace background (#f3f4f6)
 * Typography: Modern Geometric Sans-serif Style
 */

/* Import Google Fonts locally or use premium system font stack for offline compatibility */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Main Layout Colors */
    --bg-workspace: #f3f4f6;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    
    /* Font Colors */
    --text-primary: #111827;     /* Dark gray */
    --text-secondary: #4b5563;   /* Medium gray */
    --text-muted: #9ca3af;       /* Light gray */
    
    /* Theme Action Colors */
    --color-primary: #6366f1;     /* Indigo/Purple */
    --color-primary-hover: #4f46e5;
    --color-teal: #0ea5e9;
    --color-success: #10b981;
    --color-warning: #f97316;
    --color-danger: #ef4444;

    /* Card Gradient Colors (Osten Style) */
    --card-gradient-purple: linear-gradient(135deg, #6366f1, #818cf8);
    --card-gradient-teal: linear-gradient(135deg, #0ea5e9, #38bdf8);
    --card-gradient-green: linear-gradient(135deg, #10b981, #34d399);
    --card-gradient-orange: linear-gradient(135deg, #f97316, #fb923c);

    /* Sidebar Theme */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --sidebar-text: #4b5563;
    --sidebar-text-muted: #9ca3af;
    --sidebar-active-bg: #eff6ff; /* Soft light blue */
    --sidebar-active-text: #2563eb; /* Royal blue */
}

/* Base Styles & Typography */
body {
    background-color: var(--bg-workspace);
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}
a:hover {
    color: var(--color-primary-hover);
    text-decoration: none;
}

/* Master Layout Framework */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Left Sidebar Styles */
.left-sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.sidebar-brand-container {
    padding: 24px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-img {
    height: 35px;
    width: 35px;
    object-fit: contain;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background-color: var(--color-primary);
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #1e1b4b; /* Deep Navy */
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-divider {
    padding: 15px 24px 8px 24px;
    font-size: 11px;
    font-weight: 700;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu-item {
    margin: 4px 16px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--sidebar-text);
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    gap: 12px;
    transition: all 0.15s ease-in-out;
}

.sidebar-menu-link:hover {
    background-color: #f9fafb;
    color: var(--text-primary);
}

.sidebar-menu-item.active .sidebar-menu-link {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.sidebar-menu-link .menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: inherit;
    opacity: 0.85;
}

/* Main Workspace Styles */
.main-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent flex blowouts */
}

/* Top Header Bar */
.top-header-bar {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
}

.header-title-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile-dropdown {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    font-size: 32px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.user-details-header {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-fullname {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role-tag {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.logout-link-container {
    border-left: 1px solid var(--border-color);
    padding-left: 15px;
    margin-left: 5px;
}

.header-logout-btn {
    color: var(--text-muted);
    font-size: 18px;
    transition: color 0.15s ease-in-out;
}

.header-logout-btn:hover {
    color: var(--color-danger);
}

/* Page Content Area */
.page-content-wrapper {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Workspace Footer */
.main-workspace-footer {
    height: 50px;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Dashboard Summary Cards Layout (Osten Style) */
.summary-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .summary-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .summary-cards-row {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    border-radius: 12px;
    padding: 24px;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.summary-card::before {
    content: '';
    position: absolute;
    right: -10px;
    bottom: -15px;
    font-size: 90px;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    opacity: 0.15;
    pointer-events: none;
}

/* Apply icons via FA pseudo-elements for Osten aesthetic */
.summary-card.card-purple::before { content: "\f290"; } /* shopping bag icon */
.summary-card.card-teal::before { content: "\f201"; }   /* chart line icon */
.summary-card.card-green::before { content: "\f53d"; }  /* money bill wave */
.summary-card.card-orange::before { content: "\f071"; } /* exclamation triangle */

.summary-card.card-purple { background: var(--card-gradient-purple); }
.summary-card.card-teal { background: var(--card-gradient-teal); }
.summary-card.card-green { background: var(--card-gradient-green); }
.summary-card.card-orange { background: var(--card-gradient-orange); }

.card-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.card-value {
    font-size: 26px;
    font-weight: 700;
    margin: 8px 0;
}

.card-subtext {
    font-size: 11px;
    opacity: 0.85;
}

/* White layouts (Containers / Cards) */
.content-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    padding: 24px;
    margin-bottom: 30px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* CRUD Data Tables Typography & UI */
.custom-table-container {
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-table th {
    background-color: #f9fafb;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    text-align: left;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13.5px;
    vertical-align: middle;
}

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

.custom-table tr:hover td {
    background-color: #f9fafb;
}

/* Action Icons */
.action-btn-group {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: none;
    transition: all 0.15s ease-in-out;
}

.action-btn-view { background-color: #f0fdf4; color: var(--color-success); }
.action-btn-view:hover { background-color: var(--color-success); color: #ffffff; }

.action-btn-edit { background-color: #eff6ff; color: #3b82f6; }
.action-btn-edit:hover { background-color: #3b82f6; color: #ffffff; }

.action-btn-delete { background-color: #fef2f2; color: var(--color-danger); }
.action-btn-delete:hover { background-color: var(--color-danger); color: #ffffff; }

.action-btn-shield { background-color: #fef3c7; color: #d97706; }
.action-btn-shield:hover { background-color: #d97706; color: #ffffff; }

/* Status Badges */
.badge-custom {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-info { background-color: #e0f2fe; color: #0369a1; }
.badge-secondary { background-color: #f3f4f6; color: #374151; }

/* Forms, Inputs, Buttons */
.form-group {
    margin-bottom: 20px;
}

.form-label-custom {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.form-control-custom {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    background-color: #ffffff;
    color: var(--text-primary);
    transition: all 0.15s ease-in-out;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-custom {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease-in-out;
    border: none;
    cursor: pointer;
}

.btn-custom-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}
.btn-custom-primary:hover {
    background-color: var(--color-primary-hover);
    color: #ffffff;
}

.btn-custom-secondary {
    background-color: #f3f4f6;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-custom-secondary:hover {
    background-color: #e5e7eb;
    color: var(--text-primary);
}

/* Quick Actions Panel/Area (Osten Style Right Side or Distinct Blocks) */
.quick-action-card {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.quick-action-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.quick-action-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Custom Search & Live Filter Styling */
.search-wrapper-ajax {
    position: relative;
    display: flex;
    gap: 12px;
}

.search-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-ajax {
    padding-left: 40px !important;
}

/* Layout for Dashboard split view */
.dashboard-grid-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

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

/* Custom Checkbox and Toggle Switches */
.form-switch-custom {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-switch-custom input[type="checkbox"] {
    width: 40px;
    height: 20px;
    appearance: none;
    background-color: #d1d5db;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    outline: none;
}

.form-switch-custom input[type="checkbox"]:checked {
    background-color: var(--color-success);
}

.form-switch-custom input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #ffffff;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease-in-out;
}

.form-switch-custom input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* Horizontal Top Navigation Bar Styles */
.top-navbar-links {
    margin-left: 20px;
}
.top-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 6px;
}
.top-nav-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sidebar-text);
    border-radius: 6px;
    transition: all 0.15s ease-in-out;
    gap: 8px;
}
.top-nav-link:hover {
    background-color: #f3f4f6;
    color: var(--text-primary);
}
.top-nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}
.top-nav-link i {
    font-size: 14px;
    opacity: 0.85;
}
