/* DeliveryDost - Professional Minimalist Design */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --text: #334155;
    --text-muted: #94a3b8;
    --sidebar-width: 260px;
    --navbar-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html { font-size: 15px; }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }

.text-muted { color: var(--text-muted) !important; }

/* Sidebar */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

#sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-brand {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-brand i {
    color: var(--warning);
    margin-right: 0.5rem;
}

/* Logo stays pinned; only the nav list scrolls once an expanded section (e.g.
   Welfare, with 6+ items) pushes the total taller than the viewport. Without
   this, expanded sections below the fold were simply unreachable — same
   sidebar markup is shared by every role (Admin/DPCM/Promoter/DP/...), so
   this fixes it everywhere at once. */
.sidebar-nav {
    padding: 1rem 0;
    list-style: none;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav .nav-item {
    margin: 0.125rem 0.75rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

/* Navigation link with badge */
.sidebar-nav .nav-link.nav-link-with-badge {
    justify-content: flex-start;
    position: relative;
}

.sidebar-nav .nav-link .badge-notification {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    min-width: 1.25rem;
    text-align: center;
}

.sidebar-nav .nav-section {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nav .nav-section::after {
    content: "\25BE"; /* down arrow */
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: rgba(255,255,255,0.6);
}

.sidebar-nav .nav-section.collapsed::after {
    transform: rotate(-90deg);
}

.sidebar-nav .nav-section:hover {
    color: rgba(255,255,255,0.7);
}

.sidebar-nav .nav-item.is-hidden {
    display: none;
}

/* Main Content */
#main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

#main.expanded {
    margin-left: 0;
}

/* Top Navbar */
.top-navbar {
    height: var(--navbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: none;
}

.navbar-toggle:hover {
    background: var(--light);
}

@media (max-width: 991px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.show { transform: translateX(0); }
    #main { margin-left: 0; }
    .navbar-toggle { display: block; }
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
}

.user-info .name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Page Content */
.page-content {
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--light);
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-card .stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
}

.stat-card .stat-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-icon.primary { background: rgba(37,99,235,0.1); color: var(--primary); }
.stat-card .stat-icon.success { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-card .stat-icon.warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card .stat-icon.danger { background: rgba(239,68,68,0.1); color: var(--danger); }

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* Forms */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    color: var(--text);
}

.form-control, .form-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.input-group-text {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

/* Tables */
.table {
    font-size: 0.9rem;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
}

.alert-success { background: rgba(16,185,129,0.1); color: #065f46; }
.alert-danger { background: rgba(239,68,68,0.1); color: #991b1b; }
.alert-warning { background: rgba(245,158,11,0.1); color: #92400e; }
.alert-info { background: rgba(37,99,235,0.1); color: #1e40af; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 3rem;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 1.5rem;
    margin-top: 0.75rem;
    color: var(--dark);
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Role Selector */
.role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.role-option {
    position: relative;
}

.role-option input {
    position: absolute;
    opacity: 0;
}

.role-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.role-option label i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.role-option label span {
    font-size: 0.85rem;
    font-weight: 500;
}

.role-option input:checked + label {
    border-color: var(--primary);
    background: rgba(37,99,235,0.05);
}

.role-option input:checked + label i {
    color: var(--primary);
}

/* OTP Input */
.otp-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    font-weight: 600;
}

/* Wizard Steps */
.wizard-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.wizard-step {
    display: flex;
    align-items: center;
}

.wizard-step .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.wizard-step .step-label {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.wizard-step.active .step-number {
    background: var(--primary);
    color: #fff;
}

.wizard-step.active .step-label {
    color: var(--text);
    font-weight: 500;
}

.wizard-step.completed .step-number {
    background: var(--success);
    color: #fff;
}

.wizard-step-divider {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 0.5rem;
}

/* Quick Actions */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    text-align: center;
}

.quick-action:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37,99,235,0.15);
    transform: translateY(-2px);
}

.quick-action i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.quick-action h5 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.quick-action p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* List Items */
.list-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.list-item:hover {
    background: var(--light);
}

.list-item:last-child {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 767px) {
    .page-content { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-card .stat-info h3 { font-size: 1.5rem; }
    .role-grid { grid-template-columns: 1fr; }
}

/* Utilities */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* ===========================================
   Serviceability Status Indicators
   =========================================== */

.serviceability-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.375rem;
    font-size: 0.8rem;
    min-height: 1.5rem;
}

.serviceability-status .status-text {
    color: var(--text-muted);
}

.serviceability-status.status-checking .status-text {
    color: var(--primary);
}

.serviceability-status.status-success .status-text {
    color: var(--success);
}

.serviceability-status.status-error .status-text,
.serviceability-status.status-not-serviceable .status-text {
    color: var(--danger);
}

.serviceability-status.status-warning .status-text {
    color: var(--warning);
}

/* Serviceability Spinner */
.serviceability-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: serviceability-spin 0.8s linear infinite;
}

@keyframes serviceability-spin {
    to { transform: rotate(360deg); }
}

/* Route Serviceability Card */
.route-serviceability-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.route-serviceability-card.card-checking {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.03);
}

.route-serviceability-card.card-success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.route-serviceability-card.card-error,
.route-serviceability-card.card-not-serviceable {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.route-serviceability-card .partners-list {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem;
}

.route-serviceability-card .partner-item {
    display: flex;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.85rem;
}

.route-serviceability-card .partner-item strong {
    min-width: 100px;
}

/* Pincode Input Styling */
.pincode-input-group {
    position: relative;
}

.pincode-input-group .form-control {
    padding-right: 2.5rem;
}

.pincode-input-group .serviceability-indicator {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Form control states for serviceability */
.form-control.pincode-checking {
    border-color: var(--primary);
}

.form-control.pincode-serviceable {
    border-color: var(--success);
}

.form-control.pincode-not-serviceable {
    border-color: var(--danger);
}

/* Submit button disabled state */
#submitBtn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

#submitBtn .serviceability-spinner {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}
