/* ====================================================
   Wholesale Store ERP — Admin Styles
   ==================================================== */

:root {
    --wse-primary:   #1a56db;
    --wse-secondary: #6b7280;
    --wse-success:   #16a34a;
    --wse-danger:    #dc2626;
    --wse-warning:   #d97706;
    --wse-light:     #f9fafb;
    --wse-dark:      #111827;
    --wse-border:    #e5e7eb;
    --wse-card-bg:   #ffffff;
    --wse-radius:    8px;
    --wse-shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

/* Wrapper */
.wse-wrap {
    padding: 20px 0;
    max-width: 1400px;
}

/* Page title */
.wse-page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--wse-dark);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Stat Cards */
.wse-stat-card {
    background: var(--wse-card-bg);
    border: 1px solid var(--wse-border);
    border-radius: var(--wse-radius);
    box-shadow: var(--wse-shadow);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow .2s;
}
.wse-stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.wse-stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.wse-stat-icon.blue   { background: #dbeafe; color: var(--wse-primary); }
.wse-stat-icon.green  { background: #dcfce7; color: var(--wse-success); }
.wse-stat-icon.orange { background: #fef3c7; color: var(--wse-warning); }
.wse-stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.wse-stat-icon.red    { background: #fee2e2; color: var(--wse-danger); }

.wse-stat-label { font-size: .82rem; color: var(--wse-secondary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.wse-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--wse-dark); line-height: 1; }

/* Cards / panels */
.wse-card {
    background: var(--wse-card-bg);
    border: 1px solid var(--wse-border);
    border-radius: var(--wse-radius);
    box-shadow: var(--wse-shadow);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.wse-card-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wse-dark);
    border-bottom: 1px solid var(--wse-border);
    padding-bottom: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Tables */
.wse-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.wse-table thead th {
    background: var(--wse-light);
    color: var(--wse-secondary);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--wse-border);
    white-space: nowrap;
}
.wse-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--wse-border);
    vertical-align: middle;
    color: var(--wse-dark);
}
.wse-table tbody tr:last-child td { border-bottom: none; }
.wse-table tbody tr:hover td { background: var(--wse-light); }

/* Badges */
.wse-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 600;
}
.wse-badge-success { background: #dcfce7; color: #166534; }
.wse-badge-danger  { background: #fee2e2; color: #991b1b; }
.wse-badge-warning { background: #fef3c7; color: #92400e; }
.wse-badge-info    { background: #dbeafe; color: #1e40af; }

/* Buttons */
.wse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity .15s, box-shadow .15s;
    text-decoration: none;
}
.wse-btn:hover { opacity: .88; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.wse-btn-primary   { background: var(--wse-primary);   color: #fff; }
.wse-btn-success   { background: var(--wse-success);   color: #fff; }
.wse-btn-danger    { background: var(--wse-danger);    color: #fff; }
.wse-btn-warning   { background: var(--wse-warning);   color: #fff; }
.wse-btn-secondary { background: var(--wse-secondary); color: #fff; }
.wse-btn-outline   { background: transparent; border: 1px solid var(--wse-border); color: var(--wse-dark); }
.wse-btn-sm { padding: 5px 11px; font-size: .8rem; }

/* Forms */
.wse-form-row { margin-bottom: 16px; }
.wse-label { display: block; font-size: .85rem; font-weight: 500; color: var(--wse-dark); margin-bottom: 6px; }
.wse-input, .wse-select, .wse-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--wse-border);
    border-radius: 6px;
    font-size: .9rem;
    color: var(--wse-dark);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.wse-input:focus, .wse-select:focus, .wse-textarea:focus {
    outline: none;
    border-color: var(--wse-primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.wse-textarea { resize: vertical; min-height: 80px; }

/* Alerts */
.wse-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.wse-alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--wse-danger); }
.wse-alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--wse-success); }
.wse-alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--wse-warning); }

/* POS specific */
.wse-pos-wrap       { display: grid; grid-template-columns: 1fr 400px; gap: 20px; height: calc(100vh - 100px); }
.wse-pos-left       { overflow-y: auto; }
.wse-pos-right      { background: var(--wse-card-bg); border: 1px solid var(--wse-border); border-radius: var(--wse-radius); padding: 16px; overflow-y: auto; }
.wse-cart-item      { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--wse-border); }
.wse-cart-item:last-child { border-bottom: none; }
.wse-cart-name      { flex: 1; font-weight: 500; }
.wse-cart-qty       { width: 70px; text-align: center; }
.wse-cart-price     { width: 90px; text-align: right; color: var(--wse-primary); font-weight: 600; }
.wse-cart-remove    { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: none; background: var(--wse-danger); color: #fff; border-radius: 50%; cursor: pointer; }
.wse-grand-total    { font-size: 1.4rem; font-weight: 700; color: var(--wse-dark); }
.wse-pos-product-search { position: relative; }
.wse-product-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 999;
    background: #fff; border: 1px solid var(--wse-border);
    border-radius: 6px; max-height: 280px; overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.wse-product-result-item {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--wse-border);
    display: flex; justify-content: space-between; align-items: center;
}
.wse-product-result-item:hover { background: var(--wse-light); }

/* Low stock badge in dashboard */
.wse-low-stock-alert { border-left: 4px solid var(--wse-danger); padding-left: 10px; margin-bottom: 6px; }

/* Ledger table colours */
.wse-debit  { color: var(--wse-danger);  font-weight: 600; }
.wse-credit { color: var(--wse-success); font-weight: 600; }
.wse-balance-positive { color: var(--wse-danger);  }
.wse-balance-zero     { color: var(--wse-success); }

/* Responsive tweaks */
@media ( max-width: 900px ) {
    .wse-pos-wrap { grid-template-columns: 1fr; height: auto; }
}

/* Loading overlay */
.wse-loading { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9999; align-items: center; justify-content: center; }
.wse-loading.active { display: flex; }
.wse-spinner { width: 48px; height: 48px; border: 5px solid #fff; border-top-color: var(--wse-primary); border-radius: 50%; animation: wse-spin .7s linear infinite; }
@keyframes wse-spin { to { transform: rotate(360deg); } }
