/* --- Global Resets & Variables --- */
:root {
    --primary-color: #3498db;
    --primary-color-rgb: 52, 152, 219;
    --primary-color-darker: #2980b9;
    --secondary-color: #2ecc71;
    --secondary-color-darker: #27ae60;
    --danger-color: #e74c3c;
    --danger-color-darker: #c0392b;
    --warning-color: #f39c12;
    --info-color: #17a2b8;

    --light-gray: #f8f9fa;
    --medium-gray: #dee2e6;
    --border-color: #ced4da;
    --dark-gray: #495057;
    --text-color: #212529;
    --text-color-light: #6c757d;

    --sidebar-bg: #2c3e50;
    --sidebar-text-color: #ecf0f1;
    --sidebar-hover-bg: #34495e;
    --sidebar-active-border: var(--secondary-color);

    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 6px;
    --box-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.075);
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-sans); }
html { font-size: 16px; }
body { background-color: var(--light-gray); color: var(--text-color); display: flex; min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Scrollbar */
body::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 6px; height: 6px; }
body::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.03); }
body::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { background-color: var(--medium-gray); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb { background-color: #4a6278; }
body, .sidebar, .modal-body { scrollbar-width: thin; scrollbar-color: var(--medium-gray) rgba(0,0,0,0.03); }
.sidebar { scrollbar-color: #4a6278 var(--sidebar-bg); }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background-color: var(--sidebar-bg); color: var(--sidebar-text-color); padding-top: 15px; position: fixed; top: 0; left: 0; height: 100%; transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 1000; overflow-y: auto; box-shadow: 3px 0 15px rgba(0,0,0,0.1); }
.sidebar-header { text-align: center; padding: 10px 20px 15px 20px; margin-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-header h2 { font-size: 1.4em; color: white; font-weight: 600; }
.sidebar-header h2 i { margin-right: 8px; color: var(--primary-color); }
.sidebar nav ul { list-style: none; padding-bottom: 20px; }
.sidebar nav ul li a { display: flex; align-items: center; padding: 12px 20px; color: var(--sidebar-text-color); text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease, border-left-color 0.2s ease; font-size: 0.9rem; font-weight: 500; border-left: 3px solid transparent; }
.sidebar nav ul li a i { margin-right: 10px; width: 18px; font-size: 1em; opacity: 0.7; transition: opacity 0.2s ease; text-align: center; }
.sidebar nav ul li a:hover { background-color: var(--sidebar-hover-bg); color: white; border-left-color: var(--primary-color); }
.sidebar nav ul li a:hover i { opacity: 1; }
.sidebar nav ul li a.active { background-color: var(--primary-color); color: white; font-weight: 600; border-left-color: var(--sidebar-active-border); }
.sidebar nav ul li a.active i { opacity: 1; }

/* Main Content */
.main-content { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); transition: margin-left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); display: flex; flex-direction: column; }

/* Content Header */
.content-header { background-color: white; padding: 0 20px; height: var(--header-height); display: flex; justify-content: space-between; align-items: center; box-shadow: var(--box-shadow-sm); position: sticky !important; top: 0; z-index: 900; border-bottom: 1px solid var(--medium-gray); position: relative; /* For mobile search */ }
.menu-toggle { display: none; font-size: 1.4em; cursor: pointer; color: var(--primary-color); padding: 10px; margin-right: 5px; }
.menu-toggle:hover { color: var(--primary-color-darker); }
.page-title { font-size: 1.3em; color: var(--text-color); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; /* Allow title to take space */ margin-right: 10px; /* Space before header actions */ }

.header-actions { display: flex; align-items: center; }
#search-bar-desktop { display: flex; align-items: center; } /* Desktop search bar */
#search-bar-desktop input { padding: 8px 10px; border: 1px solid var(--border-color); border-right: none; border-radius: var(--border-radius) 0 0 var(--border-radius); outline: none; font-size: 0.85rem; min-width: 180px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
#search-bar-desktop input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 0.15rem rgba(var(--primary-color-rgb), 0.25); z-index: 1; position: relative; }
#search-bar-desktop button { padding: 8px 10px; background-color: var(--primary-color); color: white; border: 1px solid var(--primary-color); cursor: pointer; border-radius: 0 var(--border-radius) var(--border-radius) 0; font-size: 0.85rem; transition: background-color 0.2s ease; }
#search-bar-desktop button:hover { background-color: var(--primary-color-darker); }
#search-bar-desktop button i { margin-right: 0; }

.search-toggle-btn { display: none; background: none; border: none; color: var(--primary-color); font-size: 1.2em; padding: 8px; cursor: pointer; }
.search-toggle-btn:hover { color: var(--primary-color-darker); }
.btn.icon-only i { margin-right: 0; }

.mobile-search-container { display: none; position: absolute; top: 48px; left: 0; width: 100%; background-color: white; padding: 10px; box-shadow: var(--box-shadow-sm); z-index: 890; align-items: center; gap: 5px; border-top: 1px solid var(--medium-gray); }
.mobile-search-container.active { display: flex; }
.mobile-search-container input { flex-grow: 1; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 0.9rem; }
.mobile-search-container button { padding: 8px 10px; background-color: var(--primary-color); color: white; border: 1px solid var(--primary-color); cursor: pointer; border-radius: var(--border-radius); font-size: 0.9rem; }
.mobile-search-container #mobile-search-close-btn { background-color: var(--light-gray); color: var(--text-color-light); border-color: var(--medium-gray); font-size: 1.2rem; padding: 6px 10px; }


/* Page Content */
.page-content-area { padding: 20px; flex-grow: 1; overflow-y: auto; }
.page { display: none; animation: fadeIn 0.4s ease-out; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Dashboard */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.stat-card { background-color: white; padding: 15px 20px; border-radius: var(--border-radius); box-shadow: var(--box-shadow-sm); text-align: center; border: 1px solid var(--medium-gray); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--box-shadow); }
.stat-card i { font-size: 2.2em; margin-bottom: 10px; }
.stat-card:nth-child(1n) i { color: var(--primary-color); } .stat-card:nth-child(2n) i { color: var(--secondary-color); } .stat-card:nth-child(3n) i { color: var(--info-color); } .stat-card:nth-child(4n) i { color: var(--warning-color); }
.stat-card h3 { font-size: 0.8rem; margin-bottom: 5px; color: var(--text-color-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card p { font-size: 1.8em; font-weight: 700; color: var(--text-color); }

/* Lists & Buttons */
.action-bar { margin-bottom: 20px; display: flex; justify-content: flex-end; align-items: center; }
.btn { padding: 8px 15px; border: 1px solid transparent; border-radius: var(--border-radius); cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s ease; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; line-height: 1.5; }
.btn i { margin-right: 6px; font-size: 1em; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--box-shadow-sm); } .btn:active { transform: translateY(0px); box-shadow: none; }
.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); color: white; } .btn-primary:hover { background-color: var(--primary-color-darker); border-color: var(--primary-color-darker); }
.btn-secondary { background-color: #e9ecef; border-color: #ced4da; color: var(--text-color); } .btn-secondary:hover { background-color: #d3d9df; border-color: #adb5bd; }
.btn-success { background-color: var(--secondary-color); border-color: var(--secondary-color); color: white; } .btn-success:hover { background-color: var(--secondary-color-darker); border-color: var(--secondary-color-darker); }
.btn-danger { background-color: var(--danger-color); border-color: var(--danger-color); color: white; } .btn-danger:hover { background-color: var(--danger-color-darker); border-color: var(--danger-color-darker); }
.btn-info { background-color: var(--info-color); border-color: var(--info-color); color: white; } .btn-info:hover { background-color: #138496; border-color: #117a8b; }

.list-container { display: grid; gap: 15px; }
.list-item { background-color: white; border-radius: var(--border-radius); box-shadow: var(--box-shadow-sm); padding: 15px; display: flex; align-items: center; gap: 15px; border: 1px solid var(--medium-gray); transition: box-shadow 0.2s ease; }
.list-item:hover { box-shadow: var(--box-shadow); }
.list-item-image { width: 60px; height: 60px; flex-shrink: 0; border-radius: var(--border-radius); object-fit: cover; background-color: var(--light-gray); display: flex; align-items: center; justify-content: center; color: var(--text-color-light); border: 1px solid var(--medium-gray); overflow: hidden; }
.list-item-image img { width: 100%; height: 100%; object-fit: cover; } .list-item-image i { font-size: 1.8em; opacity: 0.6; }
.list-item-details { flex-grow: 1; min-width: 0; }
.list-item-details h4 { font-size: 1em; margin-bottom: 4px; color: var(--primary-color); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-details p { font-size: 0.8rem; color: var(--text-color-light); margin-bottom: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-details p strong { color: var(--text-color); font-weight: 500; }
.list-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.list-item-actions .btn { padding: 6px 10px; font-size: 0.8rem; }

/* Forms */
.settings-form h3, #product-requests-page h3, #product-list-page h3 { font-size: 1.2em; font-weight: 600; color: var(--text-color); margin-bottom: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--medium-gray); }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.85rem; color: var(--text-color); }
input[type="text"], input[type="password"], input[type="username"], input[type="url"], input[type="file"], select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 0.9rem; color: var(--text-color); background-color: white; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
input:not([type="radio"]):not([type="checkbox"]):focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 0.15rem rgba(var(--primary-color-rgb), 0.25); }
input[type="file"] { padding: 6px 8px; }
input[type="file"]::-webkit-file-upload-button { padding: 6px 8px; margin-right: 8px; background: var(--light-gray); border: 1px solid var(--border-color); color: var(--text-color); border-radius: var(--border-radius); cursor: pointer; font-weight: 500; transition: background-color 0.2s ease; }
input[type="file"]::-webkit-file-upload-button:hover { background: var(--medium-gray); }
textarea { min-height: 80px; resize: vertical; }

/* Modal */
.modal { display: none; position: fixed; z-index: 1050; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background-color: rgba(33,37,41,0.6); padding: 15px; align-items: center; justify-content: center; }
.modal-content { background-color: white; margin: 0 auto; border: none; width: 100%; max-width: 700px; border-radius: var(--border-radius); box-shadow: var(--box-shadow); position: relative; display: flex; flex-direction: column; max-height: calc(100vh - 30px); overflow: hidden; }
.modal-content.large { max-width: 900px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--medium-gray); background-color: var(--light-gray); flex-shrink: 0; }
.modal-header h3 { font-size: 1.2em; color: var(--primary-color); font-weight: 600; }
.close-modal { color: var(--text-color-light); font-size: 20px; font-weight: bold; cursor: pointer; padding: 5px; line-height: 1; transition: color 0.2s ease; }
.close-modal:hover, .close-modal:focus { color: var(--danger-color); }
.modal-body { padding: 15px; overflow-y: auto; flex-grow: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 15px; }
.form-grid .form-group-full { grid-column: 1 / -1; }
.input-group { display: flex; }
.input-group input[type="text"] { border-radius: var(--border-radius) 0 0 var(--border-radius); flex-grow: 1; border-right: 0; }
.input-group input[type="text"]:focus { z-index: 1; }
.input-group .btn { border-radius: 0 var(--border-radius) var(--border-radius) 0; box-shadow: none; }
.input-group .btn:hover { transform: none; }
.alternative-section { border-top: 1px solid var(--medium-gray); padding-top: 15px; margin-top: 15px; }
.alternative-section h5 { font-size: 1em; color: var(--text-color); margin-bottom: 12px; font-weight: 600; }
.modal-footer { padding: 10px 15px; border-top: 1px solid var(--medium-gray); text-align: right; background-color: var(--light-gray); flex-shrink: 0; }
.modal-footer .btn { margin-left: 6px; }
.name-fix{
    padding-top: 12px !important;
    padding-bottom: 12px !important;

}
.alt-fix{
    padding-top: 10px !important;
    padding-bottom: 10px !important;

}


/* Responsive */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: 5px 0 15px rgba(0,0,0,0.2); }
    .main-content { margin-left: 0; width: 100%; }
    .menu-toggle { display: block; }
    .form-grid { grid-template-columns: 1fr; }
    .modal-content.large { max-width: 95%; }
}

@media (max-width: 767.98px) {
    :root { --header-height: 55px; } html { font-size: 15px; }
    .content-header { padding: 0 15px; }
    #search-bar-desktop input { min-width: 120px; font-size: 0.8rem; }
    #search-bar-desktop button { font-size: 0.8rem; }
    .page-content-area { padding: 15px; }
    .dashboard-stats { grid-template-columns: 1fr; gap: 15px; }
    .stat-card { padding: 12px 15px; } .stat-card i { font-size: 2em; } .stat-card p { font-size: 1.6em; }
    .modal-content { max-width: 90%; }
}

@media (max-width: 575.98px) {
    :root { --header-height: 50px; } html { font-size: 14px; }
    .sidebar { width: 240px; }
    .content-header { padding: 0 10px; }
    .page-title { font-size: 1.1em; margin-right: 5px; /* Less space if only menu toggle */ }

    #search-bar-desktop { display: none; } /* Hide original desktop search */
    .search-toggle-btn { display: block; margin-left: 5px; /* Space from page title or menu toggle */ }
    .header-actions { margin-left: auto; /* Pushes search toggle to the right */ }


    .list-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .list-item-image { width: 100%; height: 150px; margin-bottom: 5px; }
    .list-item-actions { width: 100%; margin-top: 8px; justify-content: flex-end; }
    .list-item-actions .btn { flex-grow: 1; max-width: 48%; }

    .modal-content { max-width: 95%; max-height: calc(100vh - 20px); }
    .modal-body { padding: 10px; }
    .modal-header, .modal-footer { padding: 8px 10px; }
    .modal-header h3 { font-size: 1.1em; } .modal-footer .btn { font-size: 0.8rem; padding: 6px 10px;}

    .action-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .action-bar .btn { width: 100%; }
    .btn { font-size: 0.85rem; padding: 10px 12px; }
}
 /* Ensure mobile search and toggle are hidden on larger screens */
@media (min-width: 575.99px) {
    .mobile-search-container { display: none !important; }
    .search-toggle-btn { display: none !important; }
}

/* System Maintenance Styles */
.maintenance-section {
    margin-top: .5rem;
    display: grid;
    gap: 1.5rem;
}

.maintenance-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-sm);
    border: 1px solid var(--medium-gray);
    overflow: hidden;
}

.maintenance-header {
    background-color: var(--light-gray);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.maintenance-header i {
    font-size: 1.2rem;
    color: var(--warning-color);
}

.maintenance-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.maintenance-content {
    padding: 1.5rem;
}

.maintenance-description {
    color: var(--text-color-light);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.maintenance-card .btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
}

.maintenance-card .btn i {
    font-size: 1.1rem;
}
