/* ============================================================
   HamAndish — Admin Styles
   ============================================================ */

:root {
    --ha-primary: #1e3a5f;
    --ha-primary-light: #2c5282;
    --ha-accent: #c9a227;
    --ha-bg: #f4f6f9;
    --ha-card: #ffffff;
    --ha-text: #1a202c;
    --ha-text-muted: #718096;
    --ha-border: #e2e8f0;
    --ha-danger: #e53e3e;
    --ha-success: #38a169;
    --ha-warning: #d69e2e;
    --ha-radius: 10px;
    --ha-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --ha-shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    background: var(--ha-bg);
    color: var(--ha-text);
    font-size: 14px;
    line-height: 1.7;
    direction: rtl;
}

a { color: var(--ha-primary-light); text-decoration: none; }
a:hover { color: var(--ha-primary); }

/* ============================================================
   Layout
   ============================================================ */
.ha-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.ha-sidebar {
    background: var(--ha-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.ha-brand {
    padding: 0 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.ha-brand a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.ha-brand-logo {
    width: 40px;
    height: 40px;
    background: var(--ha-accent);
    color: var(--ha-primary);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    line-height: 1;
    padding-top: 4px;
}

.ha-brand-name {
    font-size: 20px;
    font-weight: 700;
}

.ha-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.ha-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--ha-radius);
    color: rgba(255,255,255,0.85);
    transition: all 0.15s;
    font-size: 14px;
}

.ha-nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.ha-nav-item.active {
    background: var(--ha-accent);
    color: var(--ha-primary);
    font-weight: 600;
}

.ha-nav-icon { font-size: 16px; }

.ha-user-box {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ha-user-name { font-weight: 600; font-size: 13px; }
.ha-user-role { font-size: 11px; opacity: 0.7; }

.ha-logout {
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
}
.ha-logout:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ============================================================
   Main
   ============================================================ */
.ha-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ha-topbar {
    background: #fff;
    border-bottom: 1px solid var(--ha-border);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ha-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ha-text);
}

.ha-content {
    padding: 28px 32px;
    flex: 1;
}

/* ============================================================
   Alerts
   ============================================================ */
.ha-alert {
    padding: 12px 18px;
    border-radius: var(--ha-radius);
    margin-bottom: 16px;
    font-size: 13px;
    border-right: 4px solid transparent;
}
.ha-alert-success { background: #f0fff4; color: #22543d; border-color: var(--ha-success); }
.ha-alert-error   { background: #fff5f5; color: #742a2a; border-color: var(--ha-danger); }
.ha-alert-warning { background: #fffaf0; color: #7b341e; border-color: var(--ha-warning); }
.ha-alert-info    { background: #ebf8ff; color: #2a4365; border-color: var(--ha-primary-light); }

/* ============================================================
   Cards
   ============================================================ */
.ha-card {
    background: var(--ha-card);
    border-radius: var(--ha-radius);
    box-shadow: var(--ha-shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.ha-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ha-border);
}

/* ============================================================
   Buttons
   ============================================================ */
.ha-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--ha-radius);
    border: 1px solid transparent;
    background: var(--ha-primary);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.ha-btn:hover { background: var(--ha-primary-light); color: #fff; }
.ha-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ha-btn-accent { background: var(--ha-accent); color: var(--ha-primary); }
.ha-btn-accent:hover { background: #b8912a; color: var(--ha-primary); }

.ha-btn-outline {
    background: transparent;
    border-color: var(--ha-border);
    color: var(--ha-text);
}
.ha-btn-outline:hover { background: var(--ha-bg); color: var(--ha-text); }

.ha-btn-danger { background: var(--ha-danger); }
.ha-btn-danger:hover { background: #c53030; }

.ha-btn-sm { padding: 6px 12px; font-size: 12px; }

/* ============================================================
   Forms
   ============================================================ */
.ha-form-group {
    margin-bottom: 18px;
}

.ha-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ha-text);
}

.ha-label .required { color: var(--ha-danger); }

.ha-input,
.ha-textarea,
.ha-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ha-border);
    border-radius: var(--ha-radius);
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--ha-text);
    transition: border-color 0.15s;
}

.ha-input:focus,
.ha-textarea:focus,
.ha-select:focus {
    outline: none;
    border-color: var(--ha-primary-light);
    box-shadow: 0 0 0 3px rgba(44,82,130,0.1);
}

.ha-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.8;
}

.ha-help {
    font-size: 12px;
    color: var(--ha-text-muted);
    margin-top: 4px;
}

.ha-error-text {
    font-size: 12px;
    color: var(--ha-danger);
    margin-top: 4px;
}

/* ============================================================
   Table
   ============================================================ */
.ha-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ha-table th,
.ha-table td {
    padding: 12px 14px;
    text-align: right;
    border-bottom: 1px solid var(--ha-border);
}

.ha-table th {
    background: var(--ha-bg);
    font-weight: 600;
    color: var(--ha-text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.ha-table tr:hover td { background: #fafbfc; }

/* ============================================================
   Badges
   ============================================================ */
.ha-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.ha-badge-draft    { background: #edf2f7; color: #4a5568; }
.ha-badge-active   { background: #c6f6d5; color: #22543d; }
.ha-badge-closed   { background: #fed7d7; color: #742a2a; }

/* ============================================================
   Grid
   ============================================================ */
.ha-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ha-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

@media (max-width: 768px) {
    .ha-layout { grid-template-columns: 1fr; }
    .ha-sidebar { display: none; }
    .ha-grid-2, .ha-grid-3 { grid-template-columns: 1fr; }
    .ha-content { padding: 16px; }
    .ha-topbar { padding: 14px 16px; }
}

/* ============================================================
   Auth pages (login/register)
   ============================================================ */
.ha-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
}

.ha-auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--ha-shadow-lg);
    padding: 40px 32px;
}

.ha-auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.ha-auth-brand-logo {
    width: 64px;
    height: 64px;
    background: var(--ha-accent);
    color: var(--ha-primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 12px;
}

.ha-auth-brand-name {
    font-size: 26px;
    font-weight: 700;
    color: var(--ha-primary);
}

.ha-auth-tagline {
    font-size: 13px;
    color: var(--ha-text-muted);
    margin-top: 4px;
}

.ha-auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--ha-text-muted);
}

.ha-captcha-box {
    background: var(--ha-bg);
    border: 1px dashed var(--ha-border);
    padding: 12px 18px;
    border-radius: var(--ha-radius);
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--ha-primary);
    margin-bottom: 10px;
    user-select: none;
}

/* ============================================================
   Toast Notification
   ============================================================ */
.ha-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e3a5f;
    color: #fff;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    max-width: 90vw;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    direction: rtl;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.ha-toast.ha-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ha-toast.ha-toast-error {
    background: #e53e3e;
}

.ha-user-info {
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
}

.ha-user-info:hover {
    background: rgba(255, 255, 255, 0.08);
}