/* ID-Shaydi Admin — static panel styles */
:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-soft: #eff6ff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e8edf3;
    --white: #ffffff;
    --green: #16a34a;
    --orange: #f59e0b;
    --red: #ef4444;
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* —— Sidebar —— */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 1px 0 0 rgba(15, 23, 42, 0.04);
}

.brand {
    padding: 20px 18px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.brand-text p {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

.sidebar nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-label {
    margin: 0 0 8px 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--text);
}

.nav-link.active {
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 600;
}

.nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--blue);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-text {
    line-height: 1;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.footer-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

/* —— Main —— */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.topbar span {
    font-size: 12px;
    color: var(--muted);
}

.content {
    padding: 24px 28px 40px;
}

/* —— Cards & stats —— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-card h3 {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--blue);
    line-height: 1.1;
}

.stat-card .hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.panel-head span {
    font-size: 12px;
    color: var(--muted);
}

/* —— Table —— */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-green { background: #dcfce7; color: var(--green); }
.badge-blue { background: #dbeafe; color: var(--blue); }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-gray { background: #f1f5f9; color: var(--muted); }
.badge-red { background: #fee2e2; color: var(--red); }

/* —— Settings form (static) —— */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    padding: 20px;
}

.field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
    color: var(--text);
}

.note {
    margin-top: 20px;
    padding: 14px 18px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    font-size: 13px;
    color: #1e40af;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 20px;
}

.product-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.product-card h4 {
    margin: 0 0 4px;
    font-size: 15px;
}

.product-card p {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--muted);
}

.product-card .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--blue);
}

/* —— Login —— */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1565c0 0%, #1e88e5 50%, #42a5f5 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: 18px;
    padding: 32px 28px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.18);
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.login-brand h1 {
    margin: 10px 0 4px;
    font-size: 22px;
    color: var(--text);
}

.login-brand p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.login-error {
    background: #fee2e2;
    color: var(--red);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}

.login-form .field {
    margin-bottom: 16px;
}

.login-form .field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.login-form .field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.login-form .field input:focus {
    border-color: var(--blue);
}

.btn-login {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-login:hover {
    background: var(--blue-dark);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-actions span {
    font-size: 12px;
    color: var(--muted);
}

.logout-form { margin: 0; }

.btn-logout {
    padding: 8px 16px;
    background: #fee2e2;
    color: var(--red);
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-logout:hover {
    background: #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: var(--green);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
}

.btn-primary {
    padding: 9px 18px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover { background: var(--blue-dark); }

.btn-secondary {
    padding: 9px 18px;
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-save {
    padding: 8px 16px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.product-form-wrap {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.product-form .form-row {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 14px;
}

.product-form .field,
.product-fields .field,
.product-price-col .field {
    margin-bottom: 12px;
}

.product-form .field label,
.product-fields .field label,
.product-price-col .field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.product-form input[type="text"],
.product-form input[type="number"],
.product-form input[type="file"],
.product-fields input,
.product-price-col input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
}

.price-input {
    font-weight: 700;
    color: var(--blue);
    max-width: 120px;
}

.field-error {
    display: block;
    color: var(--red);
    font-size: 11px;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.products-list {
    padding: 12px;
}

.product-row {
    display: grid;
    grid-template-columns: 72px 1fr 220px;
    gap: 16px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    background: #fafbfc;
}

.product-thumb img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.product-thumb-placeholder {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border-radius: 10px;
    font-size: 28px;
}

.product-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.empty-products {
    padding: 32px;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 900px) {
    .product-row {
        grid-template-columns: 1fr;
    }
    .product-fields {
        grid-template-columns: 1fr;
    }
    .product-form .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar { width: 72px; }
    .brand-text, .nav-label, .nav-text, .footer-text { display: none; }
    .brand { padding: 14px 10px; }
    .brand-inner { justify-content: center; }
    .brand img { width: 38px; height: 38px; }
    .nav-link { justify-content: center; padding: 12px; }
    .nav-link.active::before { display: none; }
    .sidebar-footer { justify-content: center; padding: 12px; }
    .main { margin-left: 72px; }
    .content { padding: 16px; }
}
