/* public/css/style.css */

:root {
    --primary-color: #3D665E;     /* MediCore Dark Sage */
    --primary-hover: #2A4B44;     
    --primary-light: #E6EFEA;     /* Light Sage Mint */
    --secondary-color: #2A524A;   /* Deep Sage */
    --accent-color: #1C3F38;      /* Forest Green */
    --success-color: #2ecc71;     
    --warning-color: #e67e22;     
    --danger-color: #e74c3c;      
    --background-color: #EAF2EE;  /* Light Mint Pastel */
    --card-bg: #ffffff;
    --text-primary: #1C3F38;      /* Forest Green Text */
    --text-muted: #688A83;        /* Muted Sage Text */
    --border-color: #D2E2DB;      /* Soft Mint Border */
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #5C8D82 0%, #203A34 100%); /* Rich, deep vertical gradient */
    --sidebar-text: #ffffff;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout Structure */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s ease;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: hidden;
}

#sidebar.active {
    left: calc(-1 * var(--sidebar-width));
}

#sidebar .sidebar-header {
    padding: 10px;
    background: #ffffff;
    margin: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

#sidebar .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    text-decoration: none;
}

#sidebar .sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar .sidebar-menu li {
    padding: 2px 15px;
}

#sidebar .sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#sidebar .sidebar-menu li a:hover,
#sidebar .sidebar-menu li.active a {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#sidebar .sidebar-menu li.active a {
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(13, 138, 114, 0.25);
}

#sidebar .sidebar-footer {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    color: #cbd5e1;
}

#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    margin-left: var(--sidebar-width);
}

#sidebar.active + #content {
    margin-left: 0;
    width: 100%;
}

.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
}

.main-content {
    padding: 30px;
    flex-grow: 1;
}

/* Dynamic Cards with Soft Shadows */
.card-kpi {
    border: none;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.card-kpi .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--primary-light);
    color: var(--primary-color);
}

.card-kpi.kpi-revenue .kpi-icon { background: #e6efea; color: #3d665e; }
.card-kpi.kpi-profit .kpi-icon { background: #eafaf1; color: #2ecc71; }
.card-kpi.kpi-sales .kpi-icon { background: #e6efea; color: #3d665e; }
.card-kpi.kpi-alert .kpi-icon { background: #fdf2e9; color: #e67e22; }
.card-kpi.kpi-danger .kpi-icon { background: #fdebd0; color: #e74c3c; }

/* Custom Badge / Alerts */
.badge-pill {
    padding: 6px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Glassmorphism Panel styles for lists */
.panel-premium {
    border: none;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 30px;
}

/* Tables design */
.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table-premium th {
    background: transparent;
    border: none;
    padding: 12px 18px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-premium tr {
    transition: transform 0.2s ease;
}

.table-premium td {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 18px;
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-premium td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.table-premium td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.table-premium tr:hover td {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Search bar autocomplete results dropdown */
.autocomplete-suggestions {
    position: absolute;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.autocomplete-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.autocomplete-suggestion-item:hover {
    background: #f1f5f9;
}

/* POS checkout / billing screen styles */
.pos-cart-panel {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
}

.pos-cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
}

.pos-cart-summary {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 20px;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.pos-cart-item-row {
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 0;
}

.pos-cart-item-row:last-child {
    border-bottom: none;
}

/* Form Styles */
.form-control-premium {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.form-control-premium:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 138, 114, 0.15);
    outline: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    #sidebar.active {
        left: 0;
    }
    #content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .top-navbar {
        padding: 15px;
    }
    .main-content {
        padding: 15px;
    }
}

/* Receipt design print view styling */
.receipt-container {
    max-width: 400px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    padding: 25px;
    border-radius: 8px;
    margin: 0 auto;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.85rem;
}

.receipt-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 15px;
}

.receipt-header h3 {
    margin: 0;
    font-weight: bold;
    font-size: 1.2rem;
}

.receipt-table {
    width: 100%;
    margin-bottom: 15px;
}

.receipt-table th, .receipt-table td {
    padding: 5px 0;
}

/* Searchable Select Dropdown Styling */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}
.searchable-select-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem !important;
}
.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    z-index: 1050;
    margin-top: 4px;
}
.searchable-select-item {
    padding: 10px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
}
.searchable-select-item:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}
.searchable-select-item.selected {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

.receipt-total {
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
    padding: 10px 0;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

/* Premium Preloader Overlay */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #EAF2EE;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.preloader-content {
    text-align: center;
}
.preloader-logo {
    max-height: 80px;
    animation: logo-pulse 1.8s infinite ease-in-out;
}
.preloader-spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto 0;
    border: 3px solid rgba(13, 138, 114, 0.15);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin-loader 1s infinite linear;
}
@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes logo-pulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; }
}
