/* ============================================================
   School Store ERP — Public Portal Styles
   Full-page app, overrides theme, works standalone.
   ============================================================ */

/* Reset portal area */
#sse-portal, #sse-login-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a2e;
    box-sizing: border-box;
}
#sse-portal *, #sse-login-wrap * { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Full-page layout ──────────────────────────────────────── */
#sse-portal {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99990;
    background: #f4f5f7;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sse-sidebar {
    width: 220px;
    min-width: 220px;
    background: #1a1a2e;
    color: #c8c8d8;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform .25s ease;
    z-index: 100;
}

.sse-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sse-sidebar-icon { font-size: 28px; }
.sse-sidebar-title { font-size: 15px; font-weight: 600; color: #fff; }
.sse-sidebar-sub { font-size: 11px; color: #8888a8; }

.sse-nav { flex: 1; padding: 12px 0; }
.sse-nav-group {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5555778;
    color: #6666888;
    padding: 14px 16px 4px;
    opacity: .6;
}
.sse-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: #b0b0c8;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    font-size: 13.5px;
}
.sse-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sse-nav-item.active {
    background: rgba(99,102,241,.18);
    color: #a5b4fc;
    border-left-color: #6366f1;
}
.sse-nav-icon { width: 18px; text-align: center; font-size: 15px; }

.sse-sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sse-user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sse-avatar {
    width: 34px; height: 34px;
    background: #6366f1;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #fff;
    flex-shrink: 0;
}
.sse-user-name { font-size: 13px; font-weight: 600; color: #e0e0f0; }
.sse-user-role { font-size: 11px; color: #7777a0; }

/* ── Main area ────────────────────────────────────────────── */
.sse-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.sse-topbar {
    height: 52px;
    background: #fff;
    border-bottom: 1px solid #e8e8f0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    flex-shrink: 0;
}
.sse-topbar-title { font-size: 16px; font-weight: 600; color: #1a1a2e; flex: 1; }
.sse-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    padding: 4px;
}
#sse-topbar-msg { font-size: 13px; }

.sse-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ── Panels ───────────────────────────────────────────────── */
.sse-panel { display: none; }
.sse-panel.active { display: block; }

/* ── Stats grid ───────────────────────────────────────────── */
.sse-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.sse-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e8e8f0;
    text-align: center;
}
.sse-stat-num { display: block; font-size: 28px; font-weight: 700; color: #6366f1; }
.sse-stat-label { font-size: 12px; color: #888; margin-top: 4px; display: block; }
.sse-stock-zero { color: #dc2626; font-weight: 700; }
.sse-stock-low { color: #f59e0b; font-weight: 700; }
.sse-footer-link { display: block; text-align: center; margin-bottom: 6px; text-decoration: none; }
.sse-btn-warning { background: #f59e0b; color: #fff; border: none; }
.sse-btn-warning:hover { background: #d97706; }
.sse-btn-secondary { background: #64748b; color: #fff; border: none; }
.sse-btn-secondary:hover { background: #475569; }

/* ── Cards / forms ────────────────────────────────────────── */
.sse-form-card {
    background: #fff;
    border: 1px solid #e8e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.sse-form-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f6;
    color: #1a1a2e;
}
.sse-field { margin-bottom: 14px; }
.sse-field label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.sse-field input, .sse-field select, .sse-select {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e0e0ec;
    border-radius: 6px;
    font-size: 13.5px;
    color: #1a1a2e;
    background: #fff;
    transition: border-color .15s;
    outline: none;
}
.sse-field input:focus, .sse-field select:focus { border-color: #6366f1; }
.sse-readonly { background: #f6f6fb !important; color: #888 !important; }
.sse-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Buttons ──────────────────────────────────────────────── */
.sse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    transition: opacity .15s, background .15s;
}
.sse-btn:hover { opacity: .88; }
.sse-btn:disabled { opacity: .5; cursor: not-allowed; }
.sse-btn-primary  { background: #6366f1; color: #fff; }
.sse-btn-success  { background: #10b981; color: #fff; }
.sse-btn-danger   { background: #ef4444; color: #fff; }
.sse-btn-ghost    { background: #f0f0f8; color: #444; border: 1px solid #e0e0ec; }
.sse-btn-full     { width: 100%; justify-content: center; padding: 11px; }
.sse-btn-sm       { padding: 5px 12px; font-size: 12px; }

/* ── Tables ───────────────────────────────────────────────── */
.sse-table-wrap { overflow-x: auto; }
.sse-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e8e8f0;
    font-size: 13px;
}
.sse-table th {
    background: #f7f7fb;
    text-align: left;
    padding: 10px 12px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    border-bottom: 1px solid #e8e8f0;
}
.sse-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f8;
    color: #333;
}
.sse-table tr:last-child td { border-bottom: none; }
.sse-table tr:hover td { background: #fafafe; }

/* Badges */
.sse-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-sale     { background: #dcfce7; color: #166534; }
.badge-set_sale { background: #dbeafe; color: #1e40af; }
.badge-purchase { background: #d1fae5; color: #065f46; }
.badge-purchase_return { background: #fee2e2; color: #991b1b; }
.badge-in  { background: #dcfce7; color: #166534; }
.badge-out { background: #fee2e2; color: #991b1b; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-staff { background: #e0f2fe; color: #075985; }

/* ── Section title ────────────────────────────────────────── */
.sse-section-title { font-size: 14px; font-weight: 600; color: #444; margin: 20px 0 10px; }

/* ── Filters ──────────────────────────────────────────────── */
.sse-topbar-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.sse-search {
    padding: 7px 12px;
    border: 1.5px solid #e0e0ec;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    min-width: 200px;
}
.sse-search:focus { border-color: #6366f1; }
.sse-select-sm {
    padding: 7px 10px;
    border: 1.5px solid #e0e0ec;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    outline: none;
}

/* ── Pagination ───────────────────────────────────────────── */
.sse-pagination {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.sse-page-btn {
    padding: 5px 11px;
    border: 1px solid #e0e0ec;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: #444;
}
.sse-page-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.sse-page-btn:hover:not(.active) { background: #f0f0f8; }

/* ── Misc ─────────────────────────────────────────────────── */
.sse-muted { color: #999; font-size: 13px; }
.sse-stock-low td { color: #dc2626 !important; }
.sse-qty-in  { color: #059669; font-weight: 700; }
.sse-qty-out { color: #dc2626; font-weight: 700; }

/* ── Set items editor ─────────────────────────────────────── */
.sse-item-row {
    display: grid;
    grid-template-columns: 1fr 80px 30px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.sse-item-row input { padding: 6px 8px; border: 1.5px solid #e0e0ec; border-radius: 5px; font-size: 13px; }
.sse-remove-row { background: #fee2e2; border: none; border-radius: 4px; color: #dc2626; cursor: pointer; font-size: 16px; padding: 4px 8px; }

/* ── Login page ───────────────────────────────────────────── */
#sse-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99990;
}
.sse-login-box {
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.sse-login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.sse-logo-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.sse-login-logo h1 { font-size: 18px; font-weight: 700; color: #1a1a2e; }
.sse-login-logo p { font-size: 13px; color: #888; margin-top: 2px; }
.sse-login-footer { text-align: center; font-size: 12px; color: #bbb; margin-top: 20px; }

.sse-alert {
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 13px;
    margin-bottom: 14px;
}
.sse-alert-error   { background: #fee2e2; color: #991b1b; }
.sse-alert-success { background: #dcfce7; color: #166534; }

/* ── Toast ────────────────────────────────────────────────── */
.sse-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a1a2e;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
    animation: slideIn .3s ease;
    max-width: 340px;
}
.sse-toast.success { border-left: 4px solid #10b981; }
.sse-toast.error   { border-left: 4px solid #ef4444; }
@keyframes slideIn { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sse-sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        z-index: 200;
    }
    .sse-sidebar.open { transform: translateX(0); }
    .sse-menu-toggle { display: block; }
    .sse-row-2 { grid-template-columns: 1fr; }
    .sse-content { padding: 14px; }
}
