/* ==========================================================================
   OorjaBazaar Admin Panel Stylesheet
   ========================================================================== */

:root {
    --primary: #0b218e;
    --primary-light: #1e3bb3;
    --primary-dark: #081765;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 72px;
    --header-height: 68px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Status Colors */
    --status-new: #3b82f6;
    --status-new-bg: #eff6ff;
    --status-contacted: #f59e0b;
    --status-contacted-bg: #fffbeb;
    --status-inprogress: #8b5cf6;
    --status-inprogress-bg: #f5f3ff;
    --status-completed: #10b981;
    --status-completed-bg: #ecfdf5;
    --status-cancelled: #ef4444;
    --status-cancelled-bg: #fef2f2;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Admin Shell Layout (Sidebar + Main Content)
   ========================================================================== */

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

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: #091a6e;
    background: linear-gradient(180deg, #091a6e 0%, #0b218e 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.12);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-decoration: none;
    color: #ffffff;
    gap: 0.5rem;
}

.brand-logo-wrapper {
    background: #ffffff;
    padding: 5px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand-logo-wrapper img {
    height: 24px;
    width: auto;
    max-width: 135px;
    object-fit: contain;
    display: block;
}

.sidebar-brand .brand-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    color: #93c5fd;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.08em;
    padding: 0.6rem 0.8rem 0.3rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.nav-link.active {
    color: #ffffff;
    background: #2563eb;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-link .nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.nav-link .badge-counter {
    margin-left: auto;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-quick-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    color: #93c5fd;
}

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

/* Header */
.admin-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.4rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-breadcrumb {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

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

.live-site-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    background: #eff6ff;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.live-site-btn:hover {
    background: #dbeafe;
    color: var(--accent-hover);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    background: #fef2f2;
    color: #ef4444;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Page Content Body */
.admin-content {
    padding: 1.75rem;
    flex: 1;
}

/* ==========================================================================
   Dashboard Metrics & Widgets
   ========================================================================== */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-info h4 {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
}

.metric-icon.blue { background: #eff6ff; color: #2563eb; }
.metric-icon.amber { background: #fffbeb; color: #d97706; }
.metric-icon.purple { background: #f5f3ff; color: #7c3aed; }
.metric-icon.green { background: #ecfdf5; color: #059669; }

/* Dashboard Cards Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Market Breakdown Bars */
.market-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.market-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.market-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.market-progress-bg {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.market-progress-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ==========================================================================
   Data Table Styles (Requirements Page & Dashboard)
   ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

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

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-new {
    background: var(--status-new-bg);
    color: var(--status-new);
    border: 1px solid #bfdbfe;
}

.badge-contacted {
    background: var(--status-contacted-bg);
    color: var(--status-contacted);
    border: 1px solid #fde68a;
}

.badge-inprogress {
    background: var(--status-inprogress-bg);
    color: var(--status-inprogress);
    border: 1px solid #ddd6fe;
}

.badge-completed {
    background: var(--status-completed-bg);
    color: var(--status-completed);
    border: 1px solid #a7f3d0;
}

.badge-cancelled {
    background: var(--status-cancelled-bg);
    color: var(--status-cancelled);
    border: 1px solid #fecaca;
}

.badge-market {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    font-weight: 500;
    font-size: 0.78rem;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Filter Controls Toolbar */
.toolbar-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

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

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

.btn-success {
    background-color: #10b981;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-whatsapp {
    background-color: #25d366;
    color: #ffffff;
}

.btn-whatsapp:hover {
    background-color: #1ebc59;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
}

.action-buttons {
    display: flex;
    gap: 0.4rem;
}

/* ==========================================================================
   Details Modal Dialog
   ========================================================================== */

.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    margin-bottom: 0.9rem;
    font-size: 0.9rem;
}

.detail-label {
    width: 140px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    color: var(--text-primary);
    word-break: break-word;
}

/* ==========================================================================
   Login Page Styles
   ========================================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    background: radial-gradient(circle at 50% 50%, #f8fafc 0%, #edf2f7 100%);
    padding: 1.5rem;
}

.login-card {
    background: #0b218e;
    background: linear-gradient(155deg, #07165c 0%, #0b218e 60%, #1738bb 100%);
    width: 100%;
    max-width: 440px;
    border-radius: 5px;
    box-shadow: 0 25px 60px -15px rgba(11, 33, 142, 0.45), 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    color: #ffffff;
}

.login-header {
    background: rgba(0, 0, 0, 0.12);
    padding: 2.25rem 2rem 1.75rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.login-brand-link {
    display: inline-block;
    text-decoration: none;
    margin-bottom: 0.85rem;
}

.login-logo-wrap {
    background: #ffffff;
    padding: 8px 18px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-logo {
    max-height: 38px;
    width: auto;
    display: block;
}

.login-header h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.login-header p {
    font-size: 0.85rem;
    color: #bfdbfe;
    margin-top: 0.35rem;
}

.login-body {
    padding: 2rem;
}

.login-form-group {
    margin-bottom: 1.25rem;
}

.login-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #e0e7ff;
    margin-bottom: 0.45rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i.icon-prefix {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1rem;
}

.input-with-icon input {
    padding-left: 2.75rem;
    width: 100%;
    height: 48px;
    background-color: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.input-with-icon input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.45);
}

.btn-login {
    width: 100%;
    height: 48px;
    background: #ffffff;
    color: #0b218e;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-login:hover {
    background: #f0f4ff;
    color: #07165c;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.btn-login:active {
    transform: translateY(0);
}

.login-alert {
    padding: 0.9rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.login-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.login-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.login-card .login-alert-error {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.login-card .login-alert-success {
    background: rgba(16, 185, 129, 0.25);
    color: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.demo-credentials-box {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    color: #e0e7ff;
}

.demo-credentials-box strong {
    color: #ffffff;
}

.quick-fill-btn {
    display: inline-block;
    margin-top: 0.45rem;
    background: #10b981;
    color: #ffffff;
    border: none;
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.quick-fill-btn:hover {
    background: #059669;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 991px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

    .admin-sidebar.show {
        transform: translateX(0);
    }

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

    .menu-toggle {
        display: block;
    }

    .filter-grid {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }
}
