@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/material-icons.woff2') format('woff2');
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--light-bg);
    color: #333;
}

/* Resizing State */
body.resizing-active {
    cursor: col-resize !important;
    user-select: none !important;
}

body.resizing-active * {
    transition: none !important;
    cursor: col-resize !important;
}

/* Utility Classes for CSP Compliance */
.d-none {
    display: none !important;
}
.d-none-mobile {
    display: block;
}
.d-inline-block {
    display: inline-block !important;
}
.w-100 {
    width: 100% !important;
}
.w-80 {
    width: 80% !important;
}
.w-60 {
    width: 60% !important;
}
.w-50 {
    width: 50% !important;
}
.w-45 {
    width: 45% !important;
}
.w-40 {
    width: 40% !important;
}
.w-10 {
    width: 10% !important;
}
.w-400px {
    width: 400px !important;
    flex-shrink: 0 !important;
}
.w-350px {
    width: 350px !important;
    flex-shrink: 0 !important;
}
.w-300px {
    width: 300px !important;
    flex-shrink: 0 !important;
}
.w-250px {
    width: 250px !important;
    flex-shrink: 0 !important;
}
.w-200px {
    width: 200px !important;
    flex-shrink: 0 !important;
}
.w-180px {
    width: 180px !important;
    flex-shrink: 0 !important;
}
.w-150px {
    width: 150px !important;
    flex-shrink: 0 !important;
}
.w-140px {
    width: 140px !important;
    flex-shrink: 0 !important;
}
.w-120px {
    width: 120px !important;
    flex-shrink: 0 !important;
}
.w-100px {
    width: 100px !important;
    flex-shrink: 0 !important;
}
.w-80px {
    width: 80px !important;
    flex-shrink: 0 !important;
}
.w-70px {
    width: 70px !important;
    flex-shrink: 0 !important;
}
.w-60px {
    width: 60px !important;
    flex-shrink: 0 !important;
}
.w-50px {
    width: 50px !important;
    flex-shrink: 0 !important;
}
.w-40px {
    width: 40px !important;
    flex-shrink: 0 !important;
}
.h-100 {
    height: 100% !important;
}
.flex-1 {
    flex: 1 !important;
}
.min-h-300 {
    min-height: 300px !important;
}
.min-h-400 {
    min-height: 400px !important;
}
.min-h-600 {
    min-height: 600px !important;
}
.max-h-500 {
    max-height: 500px !important;
}
.max-h-300px {
    max-height: 300px !important;
}
.max-w-1000px {
    max-width: 1000px !important;
}
.max-w-800px {
    max-width: 800px !important;
}
.max-w-600px {
    max-width: 600px !important;
}
.max-w-500px {
    max-width: 500px !important;
}
.max-w-400px {
    max-width: 400px !important;
}
.overflow-hidden {
    overflow: hidden !important;
}
.overflow-y-auto {
    overflow-y: auto !important;
}
.p-0 {
    padding: 0 !important;
}
.p-10 {
    padding: 10px !important;
}
.p-15 {
    padding: 15px !important;
}
.p-20 {
    padding: 20px;
}
.ml-5 {
    margin-left: 5px;
}
.ml-10 {
    margin-left: 10px !important;
}
.ml-20 {
    margin-left: 20px !important;
}
.ml-45 {
    margin-left: 45px !important;
}
.ml-55 {
    margin-left: 55px !important;
}
.ml-auto {
    margin-left: auto !important;
}
.mr-5 {
    margin-right: 5px;
}
.mt-5 {
    margin-top: 5px !important;
}
.mt-10 {
    margin-top: 10px;
}
.mt-15 {
    margin-top: 15px;
}
.mt-20 {
    margin-top: 20px;
}
.mt-30 {
    margin-top: 30px;
}
.mt-auto {
    margin-top: auto !important;
}
.m-0 {
    margin: 0 !important;
}
.mb-0 {
    margin-bottom: 0 !important;
}
.mb-5 {
    margin-bottom: 5px !important;
}
.mb-10 {
    margin-bottom: 10px !important;
}
.mb-15 {
    margin-bottom: 15px !important;
}
.mb-20 {
    margin-bottom: 20px !important;
}
.mb-30 {
    margin-bottom: 30px !important;
}
.mb-40 {
    margin-bottom: 40px !important;
}
.pb-10 {
    padding-bottom: 10px !important;
}
.pt-15 {
    padding-top: 15px !important;
}
.pt-20 {
    padding-top: 20px !important;
}
.no-decoration {
    text-decoration: none;
}
.text-center {
    text-align: center;
}
.text-right {
    text-align: right !important;
}
.text-danger {
    color: var(--danger-color);
}
.text-success {
    color: var(--success-color) !important;
}
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.uppercase {
    text-transform: uppercase !important;
}
.letter-spacing-1 {
    letter-spacing: 1px !important;
}
.flex {
    display: flex;
}
.flex-column {
    display: flex;
    flex-direction: column;
}
.flex-wrap {
    flex-wrap: wrap;
}
.flex-between {
    display: flex;
    justify-content: space-between;
}
.flex-end {
    display: flex;
    justify-content: flex-end;
}
.justify-between {
    justify-content: space-between !important;
}
.justify-self-end {
    justify-self: end !important;
}
.align-center {
    align-items: center;
}
.align-start {
    align-items: flex-start !important;
}
.align-end {
    align-items: flex-end !important;
}
.gap-5 {
    gap: 5px;
}
.gap-10 {
    gap: 10px;
}
.gap-15 {
    gap: 15px;
}
.gap-20 {
    gap: 20px;
}
.gap-40 {
    gap: 40px;
}
.grid {
    display: grid;
}
.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}
.col-span-2 {
    grid-column: span 2 / span 2 !important;
}
.col-span-3 {
    grid-column: span 3 / span 3 !important;
}
.col-span-4 {
    grid-column: span 4 / span 4 !important;
}
.col-span-6 {
    grid-column: span 6 / span 6 !important;
}
.col-span-7 {
    grid-column: span 7 / span 7 !important;
}
.col-span-8 {
    grid-column: span 8 / span 8 !important;
}
.col-span-9 {
    grid-column: span 9 / span 9 !important;
}
.col-span-12 {
    grid-column: span 12 / span 12 !important;
}
.font-weight-bold {
    font-weight: bold;
}
.font-weight-normal {
    font-weight: normal !important;
}
.font-monospace {
    font-family: monospace !important;
}
.white-space-pre-wrap {
    white-space: pre-wrap !important;
}
.cursor-pointer {
    cursor: pointer !important;
}
.text-tiny {
    font-size: 0.7rem !important;
}
.text-small {
    font-size: 0.8rem !important;
}
.text-large {
    font-size: 1.2rem !important;
}
.text-muted {
    color: #6c757d;
}
.italic {
    font-style: italic !important;
}
.relative {
    position: relative;
}
.bg-light {
    background-color: var(--light-bg) !important;
}
.bg-light-grey {
    background-color: #f1f5f9 !important;
}
.bg-primary-light {
    background-color: var(--primary-light) !important;
}
.hover-bg-light:hover {
    background-color: #f1f3f5 !important;
}
.border-bottom {
    border-bottom: 1px solid var(--border-color) !important;
}
.border-top {
    border-top: 1px solid var(--border-color) !important;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.divider-v {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 10px;
}

/* Component Styles */
.filter-item {
    min-width: 220px;
}
.checkbox-inline {
    width: auto !important;
}

.filter-select {
    min-width: 200px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    line-height: 1;
}
.badge-success {
    background-color: var(--success-color);
    color: white;
}
.badge-danger {
    background-color: var(--danger-color);
    color: white;
}
.badge-warning {
    background-color: #ffc107;
    color: #212529;
}
.badge-secondary {
    background-color: #6c757d;
    color: white;
}
.badge-info {
    background-color: var(--secondary-color);
    color: white;
}
.badge-global {
    background-color: var(--global-purple);
    color: white;
}

/* Image Utilities */
.img-tiny {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #fff;
    background-position: center;
    background-size: cover;
    position: relative;
}

.login-header {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 10;
}

.login-logo-text {
    font-size: 3rem;
    font-weight: 900;
    color: var(--login-logo-color);
    line-height: 1;
    margin-bottom: 5px;
}

.login-sub-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--login-sub-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    border-top: 5px solid var(--primary-color);
    position: relative;
    z-index: 5;
}

.login-card-logo {
    max-width: 300px;
    height: auto;
}

.login-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.login-footer a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Admin Layout */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

#sidebar {
    width: 250px;
    flex-shrink: 0; /* CRITICAL: Prevents flexbox from squashing the sidebar */
    background-color: var(--dark-bg);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s ease, width 0.3s ease, padding 0.3s ease;
    z-index: 1500; /* Above main content */
}

/* Sidebar Light Theme Override (if dark-bg is white) */
#sidebar[style*="background-color: white"],
#sidebar[style*="background-color: #fff"],
#sidebar[style*="background-color: #FFF"] {
    color: #333;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1400;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-header {
    padding: 20px;
    background-color: rgba(0,0,0,0.1);
    transition: height 0.3s ease;
    flex-shrink: 0; /* Prevent header from collapsing */
}

.sidebar-header h2 {
    margin: 16px 0;
    font-size: 1.2rem;
    color: inherit;
}

.sidebar-search {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: inherit;
}

.resource-groups {
    flex: 1;
    overflow-y: auto;
}

.group-title {
    padding: 10px 20px;
    background: rgba(0,0,0,0.05);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: inherit;
    opacity: 0.7;
}

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

.resource-list li {
    padding: 10px 25px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.resource-list li:hover {
    background-color: rgba(255,255,255,0.1);
}
.resource-list li.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar-footer {
    padding: 15px;
    background-color: rgba(0,0,0,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
    color: inherit;
    opacity: 0.7;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
}

header {
    padding: 15px 25px;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-toggle {
    position: fixed;
    top: 30px; /* Centered in 100px header: (100-40)/2 = 30 */
    left: 15px; /* Centered in 70px sidebar: (70-40)/2 = 15 */
    z-index: 2000; /* Highest priority */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: background-color 0.2s, border-color 0.2s;
}

.menu-toggle:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

.menu-toggle:active {
    transform: scale(0.95);
}

.menu-toggle span {
    pointer-events: none; /* Ensure the button gets the click, not the icon */
}

.menu-toggle-spacer {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

#content-area {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#custom-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative; /* CRITICAL: Allows children to use absolute positioning for full-height layouts */
}

/* Sidebar Collapse Logic (Desktop) */
@media (min-width: 769px) {
    #sidebar.active {
        width: 70px !important;
    }
    #sidebar.active .sidebar-header {
        display: flex !important; /* Use flex to maintain rigid structure */
        align-items: center;
        justify-content: center;
        height: 100px !important; /* Physical space for the fixed button */
        min-height: 100px !important;
        flex: 0 0 100px !important; /* Prevent squashing */
        padding: 0 !important;
        margin: 0 !important;
        background-color: inherit !important;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 10; /* Ensure it stays above scrolling content */
    }
    #sidebar.active .res-name,
    #sidebar.active .sidebar-header h2,
    #sidebar.active .sidebar-header .sidebar-search,
    #sidebar.active .group-title,
    #sidebar.active .sidebar-footer {
        display: none !important;
    }
    #sidebar.active .resource-list li {
        padding: 10px;
        justify-content: center;
        overflow: hidden;
    }
    #sidebar.active .resource-list li .material-icons {
        margin-right: 0 !important;
    }
}

/* User Profile */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
    background-color: var(--primary-light);
}

.user-profile:hover #user-display {
    color: var(--primary-color);
}

/* Profile Picture in Modal */
.profile-pic-container {
    position: relative;
    width: 120px; height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-pic-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-pic-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-pic-container:hover .profile-pic-overlay {
    opacity: 1;
}

/* Image Cropper */
.cropper-container {
    width: 300px;
    height: 300px;
    position: relative;
    overflow: hidden;
    background: #eee;
    border: 1px solid var(--border-color);
    cursor: move;
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

#cropper-canvas {
    display: block;
}

/* Components */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 20px;
    margin-bottom: 20px;
}

/* Remove margin-bottom for cards inside full-height flex containers */
#custom-view > div[style*="flex: 1"] .card.m-0 {
    margin-bottom: 0 !important;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-weight: 600;
}

.mandatory-star {
    color: var(--danger-color);
    margin-left: 4px;
}

.hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    margin-left: 8px;
    cursor: help;
    position: relative;
}

.hint-icon:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    font-size: 12px;
    font-weight: normal;
}

input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"], input[type="range"], select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    height: 40px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 40px !important;
    cursor: pointer;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

input:disabled, select:disabled, textarea:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-success {
    background-color: var(--success-color);
    color: white;
}
.btn-danger {
    background-color: var(--danger-color);
    color: white;
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}
.btn-link:hover {
    color: var(--secondary-color);
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-tiny {
    padding: 2px 6px;
    font-size: 0.7rem;
}

.btn-nav {
    background-color: rgba(255,255,255,0.1);
    color: white;
    text-align: left;
    padding: 12px 20px;
}

.btn-nav:hover {
    background-color: rgba(255,255,255,0.2);
}

.btn-nav.active {
    background-color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.copy-btn:hover {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.copy-btn svg {
    display: block;
}

.copy-btn-floating {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 3000; /* Above everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 8px;
    width: 60%;
    max-height: 85vh;
    overflow-y: auto;
}

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

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-range {
    display: flex;
    gap: 5px;
    align-items: center;
}

.filter-range input {
    flex: 1;
    min-width: 100px;
    padding: 6px;
    font-size: 0.85rem;
}

.filter-quick-select {
    padding: 6px;
    font-size: 0.85rem;
    border-color: var(--border-color);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-style: italic;
    color: var(--secondary-color);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 22px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Dashboard Grid */
.dash-widget {
    display: flex;
    flex-direction: column;
    min-height: 350px;
    min-width: 0; /* CRITICAL: Allows grid items to shrink below content width */
    max-width: 100%;
    overflow: hidden;
}

.chart-container {
    flex: 1;
    position: relative;
    min-height: 250px;
    width: 100%;
    overflow: hidden;
}

.chart-widget {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    position: relative;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chart-widget.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary-color);
    cursor: grabbing;
}

.chart-widget.drag-over {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
    border: 2px solid var(--primary-color);
}

.chart-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-widget-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.chart-widget-subtitle {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 2px;
}

.remove-widget-btn {
    color: var(--danger-color);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

.edit-widget-btn, .refresh-widget-btn {
    color: var(--primary-color);
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 5px;
    margin-right: 5px;
}

.drag-widget-btn {
    cursor: grab;
    color: var(--secondary-color);
    background: none;
    border: none;
    padding: 0 5px;
    margin-right: 5px;
    display: flex;
    align-items: center;
}

.drag-widget-btn:active {
    cursor: grabbing;
}

.edit-widget-btn, .refresh-widget-btn, .remove-widget-btn, .drag-widget-btn {
    transition: color 0.2s, transform 0.1s;
}

.edit-widget-btn:hover, .refresh-widget-btn:hover {
    color: #0056b3;
    transform: scale(1.1);
}

.remove-widget-btn:hover {
    color: #bd2130;
    transform: scale(1.1);
}

.drag-widget-btn:hover {
    color: #333;
    transform: scale(1.1);
}

/* Global Notification Toast */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 4000;
    max-width: 400px;
    border-left: 5px solid var(--primary-color);
}

.notification-toast.active {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Text View Modal Styles */
.text-view-content {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    font-family: monospace;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.9rem;
}

/* Tag Multi-Select Styles */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 42px;
    background: white;
}

.tag {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--primary-color);
}

.tag-remove {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--danger-color);
}

.tag-remove:hover {
    color: #bd2130;
}

/* Searchable Dropdown Styles */
.searchable-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-display {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 40px;
}

.dropdown-display.disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 2000;
    display: none;
    flex-direction: column;
    margin-top: 2px;
}

.dropdown-menu.active {
    display: flex;
}

/* Fix for dropdowns in tables */
.datatable td.dropdown-active,
.datatable tr.dropdown-active {
    overflow: visible !important;
    z-index: 1001 !important;
    position: relative !important;
}

/* Consistent height for table inputs */
.item-row input, 
.item-row select, 
.item-row textarea,
.item-row .dropdown-display {
    height: 38px !important;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 6px 12px !important;
}

.item-row textarea {
    line-height: 1.4;
    resize: none;
    overflow: hidden;
}

.dropdown-search-container {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.dropdown-options {
    max-height: 250px;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-option:hover {
    background-color: #f1f3f5;
}

.dropdown-option.selected {
    background-color: var(--primary-color);
    color: white;
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding: 20px 0;
    margin-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 45px;
}

.timeline-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: var(--primary-color);
    overflow: hidden;
}

.timeline-icon .material-icons {
    font-size: 18px;
    display: block;
    line-height: 1;
}

.timeline-date {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 5px;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: relative;
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 10px;
    left: -7px;
    width: 12px;
    height: 12px;
    background: #f8f9fa;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.timeline-title {
    font-weight: 600;
    color: var(--dark-bg);
}

.timeline-user {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.timeline-body {
    font-size: 0.9rem;
    color: #444;
    white-space: pre-wrap;
}

.timeline-user {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.timeline-body {
    font-size: 0.9rem;
    color: #444;
    white-space: pre-wrap;
}

.timeline-status {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-top: 8px;
    text-transform: uppercase;
    font-weight: bold;
}

.status-planned { background: #fff3cd; color: #856404; }
.status-completed { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }

/* Specialized UI for Building Level Area Mapping */
.selectable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.selectable-item:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.selectable-item.assigned {
    border-left: 4px solid var(--success-color);
}

.selectable-item .action-icon {
    font-size: 20px;
    color: var(--primary-color);
}

.selectable-item.assigned .action-icon {
    color: var(--danger-color);
}

/* Proposal Preview Styles */
.preview-document {
    padding: 60px 50px;
    background: white;
    color: #333;
    line-height: 1.6;
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.preview-brand-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background-color: var(--primary-color);
}

.preview-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #aaa;
    font-weight: 800;
    margin-bottom: 8px;
}

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

.preview-table th {
    background-color: #fafafa;
    border-bottom: 1px solid #eee;
    padding: 15px 12px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1px;
}

.preview-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f1f1f1;
    vertical-align: top;
}

.preview-summary-box {
    min-width: 320px;
    padding: 25px;
    background-color: #fafafa;
    border-radius: 12px;
    border: 1px solid #eee;
}

.preview-notes-box {
    background-color: #fcfcfc;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #eee;
}

.preview-signature-line {
    width: 250px;
    border-bottom: 1px solid #333;
    margin-bottom: 10px;
}

/* Form Group Extensions */
.phone-input-group {
    display: flex;
    gap: 10px;
}

.phone-input-group select {
    width: 100px !important;
    flex-shrink: 0;
}

.phone-input-group input {
    flex: 1;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .header-filter-group label {
        display: none;
    }
    .filter-select {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%) !important;
        width: 250px !important;
    }

    #sidebar.active {
        transform: translateX(0) !important;
    }

    header {
        padding: 10px 15px !important;
        flex-wrap: wrap;
        gap: 10px;
    }

    .menu-toggle {
        background-color: var(--primary-color);
        color: white;
        border: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        left: 12px; /* Standard mobile position */
    }

    .menu-toggle:hover {
        background-color: #0056b3;
    }

    .d-none-mobile {
        display: none !important;
    }

    .menu-toggle-spacer {
        display: block !important;
        width: 40px;
    }

    .header-filter-group {
        order: 3;
        width: calc(33.33% - 7px);
    }

    .filter-select {
        min-width: 0;
        width: 100%;
        font-size: 0.8rem;
        padding: 5px 25px 5px 8px !important;
        background-position: right 5px center;
        background-size: 14px;
    }

    .user-section {
        order: 2;
    }

    #user-display {
        display: none;
    }

    #current-resource-title {
        width: 100%;
        order: 4;
        margin: 5px 0 0 0;
        font-size: 1.1rem;
    }

    #content-area {
        padding: 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }

    .search-bar {
        flex-direction: column;
    }

    .filter-item {
        min-width: 0;
        width: 100%;
    }

    .flex-between {
        flex-direction: column;
        gap: 10px;
    }

    .flex-between .flex {
        width: 100%;
        justify-content: space-between;
    }

    /* Force 1 column on mobile regardless of setting */
    .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-12 {
        grid-template-columns: 1fr !important;
    }

    .col-span-2, .col-span-3, .col-span-4, .col-span-6, .col-span-8, .col-span-9, .col-span-12 {
        grid-column: span 1 / span 1 !important;
    }

    .sidebar-header h2 {
        margin-left: 55px !important; /* Ensure title doesn't clash with button on mobile */
    }
}
