/* === ReplyKart Admin — Professional Stylesheet === */

:root {
    --sidebar-width: 250px;
    --header-height: 56px;
    --brand-primary: #4f46e5;
    --brand-primary-light: #818cf8;
    --brand-primary-bg: rgba(79, 70, 229, 0.08);
    --brand-success: #10b981;
    --brand-danger: #ef4444;
    --brand-warning: #f59e0b;
    --brand-info: #3b82f6;
    --surface-card: #ffffff;
    --surface-bg: #f1f5f9;
    --surface-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* === Layout === */

body {
    background: var(--surface-bg);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

/* === Sidebar === */

.sidebar {
    width: var(--sidebar-width);
    background: var(--text-primary);
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: var(--brand-primary-bg);
    color: var(--brand-primary-light);
    border-left-color: var(--brand-primary-light);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Main Content Area === */

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    background: var(--surface-card);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-secondary);
}

.page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.825rem;
}

.header-user .user-name {
    color: var(--text-primary);
    font-weight: 500;
}

.header-user a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
}

.header-user a:hover {
    color: var(--brand-danger);
}

.page-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1100px;
    width: 100%;
    box-sizing: border-box;
}

/* === Cards === */

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card-value.small {
    font-size: 1rem;
}

/* === Badges === */

.badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.badge-muted {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.badge-primary {
    background: var(--brand-primary-bg);
    color: var(--brand-primary);
}

/* === Tables === */

.card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--surface-border);
}

.card-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table th {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--surface-border);
    background: var(--surface-bg);
}

table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--surface-border);
    color: var(--text-primary);
    vertical-align: middle;
}

table tbody tr:hover {
    background: var(--brand-primary-bg);
}

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

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #4338ca;
    color: #fff;
}

.btn-secondary {
    background: var(--surface-bg);
    color: var(--text-secondary);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
    background: var(--surface-border);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--brand-danger);
}

.btn-danger:hover {
    background: var(--brand-danger);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

/* === Forms === */

.form-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-card legend,
.form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--surface-card);
    color: var(--text-primary);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-bg);
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.form-check input[type="checkbox"] {
    width: auto;
    accent-color: var(--brand-primary);
}

.form-check label {
    margin: 0;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-border);
}

/* === Toast notifications === */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--surface-card);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    color: var(--text-primary);
    animation: slideIn 0.3s ease;
    max-width: 380px;
    border-left: 4px solid var(--brand-info);
}

.toast-success {
    border-left-color: var(--brand-success);
}

.toast-error {
    border-left-color: var(--brand-danger);
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* === Login page (no sidebar) === */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-bg);
}

.login-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.login-card .login-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* === Pagination === */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    font-size: 0.85rem;
}

.pagination a {
    color: var(--brand-primary);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
}

.pagination a:hover {
    background: var(--brand-primary-bg);
}

.pagination .page-info {
    color: var(--text-secondary);
}

/* === Filter bar === */

.filter-bar,
.filter-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filter-bar select,
.filter-form select {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    background: var(--surface-card);
    color: var(--text-primary);
    margin: 0;
}

/* === Empty state === */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

/* === Responsive === */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .hamburger {
        display: block;
    }

    .overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 90;
    }

    .overlay.active {
        display: block;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
}

/* === Utility === */

.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.inline-actions { display: flex; gap: 0.5rem; align-items: center; }
.inline-actions form { margin: 0; }
