/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&display=swap');

:root {
    --police-navy-dark: #091524;
    --police-navy: #0f2744;
    --police-navy-light: #1b3d66;
    --police-gold: #eab308;
    --police-gold-hover: #ca8a04;
    --police-red: #ef4444;
    --police-green: #10b981;
    --bg-surface: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

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

body {
    font-family: 'Hind Siliguri', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Shell Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--police-navy-dark) 0%, var(--police-navy) 100%);
    color: #ffffff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.sidebar-title h1 {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar-title p {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

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

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    padding: 10px 14px 6px;
    letter-spacing: 0.5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: #94a3b8;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.nav-link:hover i {
    color: var(--police-gold);
}

.nav-link.active {
    background: linear-gradient(90deg, #1e3a5f 0%, #254b7a 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border-left: 4px solid var(--police-gold);
}

.nav-link.active i {
    color: var(--police-gold);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #f1f5f9;
}

/* Top Navbar */
.top-navbar {
    background-color: #ffffff;
    height: 68px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.top-page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--police-navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* User Profile Badge in Top Nav */
.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 30px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    transition: background 0.2s;
}

.user-dropdown-btn:hover {
    background: #f8fafc;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--police-navy);
}

.user-meta {
    text-align: left;
    line-height: 1.2;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role-badge {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Content Container */
.content-body {
    padding: 24px 28px;
    flex: 1;
}

/* Modern Card */
.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--police-navy);
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Tables */
.table-container {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.table-header-box {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.custom-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background-color: #dcfce7;
    color: #166534;
}

.badge-transfer {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-exempt {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-duty-slot {
    background-color: #e0f2fe;
    color: #0369a1;
    font-weight: 700;
}

.badge-incharge {
    background-color: #ede9fe;
    color: #5b21b6;
}

.badge-inspector {
    background-color: #fce7f3;
    color: #9d174d;
}

.badge-papa1 {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-papa2 {
    background-color: #ccfbf1;
    color: #115e59;
}

.badge-standby {
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px dashed #9ca3af;
}

/* Modern Form Controls */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13.5px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--police-navy-light);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(180deg, var(--police-navy-light) 0%, var(--police-navy) 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(15, 39, 68, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #254b7a 0%, #153255 100%);
    box-shadow: 0 4px 8px rgba(15, 39, 68, 0.3);
}

.btn-gold {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
}

.btn-gold:hover {
    background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
}

.btn-outline {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #475569;
}

.btn-outline:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}

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

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

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

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 650px;
    border-radius: 14px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    animation: modalFadeIn 0.2s ease-out;
}

.modal-header {
    padding: 18px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--police-navy);
}

.modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes modalFadeIn {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Duty Roster & Swap Panel Styles */
.duty-grid-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr 1fr;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
}

.duty-slot-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.duty-slot-card:hover {
    border-color: var(--police-navy-light);
}

.officer-name-highlight {
    font-weight: 700;
    color: var(--police-navy);
}

.officer-subtext {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Swap Split Layout */
.swap-panel-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.swap-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.swap-box-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--police-navy);
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Searchable Officer Select Component
   ========================================================================== */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
    user-select: none;
    font-family: 'Hind Siliguri', -apple-system, BlinkMacSystemFont, sans-serif;
}

.searchable-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 7px 12px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.searchable-trigger:hover {
    border-color: #94a3b8;
    background: #fbfcfe;
}

.searchable-select-wrapper.open .searchable-trigger,
.searchable-trigger:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
    background: #ffffff;
}

.searchable-trigger .trigger-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}

.searchable-trigger .placeholder-text {
    color: #94a3b8;
    font-size: 13.5px;
}

.searchable-trigger .selected-item-view {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.searchable-trigger .selected-name {
    font-weight: 700;
    color: #0f2744;
    font-size: 14px;
}

.searchable-trigger .selected-rank {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0284c7;
}

.searchable-trigger .selected-bp {
    font-size: 12px;
    color: #334155;
    font-weight: 600;
}

.searchable-trigger .trigger-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.searchable-trigger .btn-clear-selection {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}

.searchable-trigger .btn-clear-selection:hover {
    background: #fee2e2;
    color: #ef4444;
}

.searchable-trigger .arrow-icon {
    font-size: 12px;
    color: #64748b;
    transition: transform 0.2s ease;
}

.searchable-select-wrapper.open .arrow-icon {
    transform: rotate(180deg);
    color: #2563eb;
}

/* Dropdown Menu Container */
.searchable-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    min-width: 320px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 39, 68, 0.16);
    z-index: 1050;
    overflow: hidden;
    animation: fadeInDown 0.15s ease-out;
}

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

/* Search Header inside Dropdown */
.searchable-search-box {
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    display: flex;
    align-items: center;
}

.searchable-search-box .search-icon {
    position: absolute;
    left: 22px;
    font-size: 13px;
    color: #94a3b8;
    pointer-events: none;
}

.searchable-search-box input {
    width: 100%;
    padding: 8px 32px 8px 34px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
}

.searchable-search-box input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.searchable-search-box .search-clear-btn {
    position: absolute;
    right: 20px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.searchable-search-box .search-clear-btn:hover {
    color: #ef4444;
}

/* Status / Match count */
.searchable-info-bar {
    padding: 6px 14px;
    background: #f1f5f9;
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Options List */
.searchable-options-list {
    max-height: 270px;
    overflow-y: auto;
    padding: 4px 0;
}

.searchable-optgroup-title {
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 4px 0;
}

.searchable-option-item {
    padding: 9px 14px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.searchable-option-item:hover,
.searchable-option-item.highlighted {
    background: #eff6ff;
    border-left-color: #2563eb;
}

.searchable-option-item.selected {
    background: #f0fdf4;
    border-left-color: #16a34a;
}

.searchable-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.searchable-option-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f2744;
}

.searchable-option-rank {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
}

.searchable-option-details {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}

.searchable-option-bp {
    font-weight: 600;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.searchable-option-branch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.search-highlight {
    background-color: #fef08a;
    color: #854d0e;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

.searchable-empty-state {
    padding: 24px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.searchable-empty-state i {
    font-size: 26px;
    color: #cbd5e1;
    margin-bottom: 8px;
    display: block;
}

/* Print Only Layout */
@media print {
    .sidebar, .top-navbar, .no-print, .btn, .modal-backdrop, footer {
        display: none !important;
    }
    body, .app-wrapper, .main-content, .content-body {
        display: block !important;
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }
}
