/* ========================================
   STALWART ADMIN DASHBOARD - CSS STYLES
   Sulu State College Security System
   ======================================== */

:root {
    --primary: #1e3a8a;
    --primary-light: #1d4ed8;
    --primary-lighter: #3b82f6;
    --accent: #93c5fd;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --dark: #1e293b;
    --gray-100: #f0f4ff;
    --gray-200: #e2e8f0;
    --gray-500: #64748b;
    --gray-700: #334155;
    --sidebar-width: 280px;
    --navbar-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--gray-100);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 28px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.college-logo {
    width: 72px;
    height: 72px;
    border-radius: 0;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.logo-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #FFFFFF;
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.logo-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    letter-spacing: 0.8px;
}

.nav-menu {
    list-style: none;
    padding: 20px 16px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.7);
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: white;
    color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.college-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    opacity: 0.8;
}


/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Top Navbar */
.top-navbar {
    height: var(--navbar-height);
    background: white;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-700);
    cursor: pointer;
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27,67,50,0.1);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

@keyframes bell-ring {
    0%, 100% { transform: rotate(0deg); }
    15%       { transform: rotate(14deg); }
    30%       { transform: rotate(-10deg); }
    45%       { transform: rotate(8deg); }
    60%       { transform: rotate(-5deg); }
    75%       { transform: rotate(3deg); }
}

@keyframes badge-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
    70%  { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 22px;
    color: var(--gray-500);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.2s, color 0.2s;
}

.notification-bell:hover {
    background: rgba(37,99,235,0.08);
    color: var(--primary-light);
}

.notification-bell.active {
    background: rgba(37,99,235,0.1);
    color: var(--primary-light);
}

.notification-bell i {
    animation: bell-ring 2.5s ease infinite;
    transform-origin: top center;
}

.notification-bell .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    border: 2px solid #fff;
    text-align: center;
    animation: badge-pulse 2s ease infinite;
    transition: opacity 0.2s;
}

/* Notification dropdown panel */
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 340px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.13);
    z-index: 9999;
    overflow: hidden;
}

.notif-dropdown.open { display: block; }

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.notif-header h6 {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.notif-mark-all {
    font-size: 12px;
    color: var(--primary-light);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.notif-mark-all:hover { text-decoration: underline; }

.notif-list { max-height: 300px; overflow-y: auto; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.notif-item:hover { background: #f8fafc; }

.notif-item.read { opacity: 0.5; }

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notif-icon.check-in  { background: #dcfce7; color: #16a34a; }
.notif-icon.alert     { background: #fef3c7; color: #d97706; }
.notif-icon.gps       { background: #dbeafe; color: #2563eb; }
.notif-icon.info      { background: #f0f4ff; color: #6366f1; }

.notif-body { flex: 1; min-width: 0; }

.notif-text {
    font-size: 13px;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 3px;
}

.notif-time {
    font-size: 11px;
    color: #94a3b8;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-light);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.notif-item.read .notif-unread-dot { visibility: hidden; }

.notif-footer {
    padding: 12px 18px;
    text-align: center;
    border-top: 1px solid #f1f5f9;
}

.notif-footer a {
    font-size: 13px;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

.notif-footer a:hover { text-decoration: underline; }

.notif-empty {
    padding: 32px 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.user-profile:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--primary);
    overflow: hidden;
    position: relative;
}

.user-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.user-avatar-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-700);
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

.user-detail {
    font-size: 11px;
    margin-top: 1px;
}

.user-role + .user-detail {
    margin-top: 0;
}

/* Night Duty card - lighter than dark */
.night-duty-header {
    background: linear-gradient(135deg, #6b7c8d 0%, #5a6c7d 100%) !important;
    color: #fff !important;
}

/* Officer of the Month */
.officer-of-month-card .card-header {
    background: linear-gradient(135deg, rgba(234,179,8,0.15) 0%, rgba(234,179,8,0.08) 100%);
    color: var(--gray-800);
}

.officer-photo-wrap {
    flex-shrink: 0;
}

.officer-photo {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid var(--accent);
}

.officer-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

/* Page Content */
.page-content {
    padding: 24px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.page-header p {
    color: var(--gray-500);
    margin-top: 4px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.stat-card.primary .stat-icon { background: rgba(27,67,50,0.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(34,197,94,0.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card.info .stat-icon { background: rgba(59,130,246,0.1); color: var(--info); }

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-700);
    display: block;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

.stat-trend {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.stat-trend.up { background: rgba(34,197,94,0.1); color: var(--success); }
.stat-trend.down { background: rgba(239,68,68,0.1); color: var(--danger); }

/* Cards */
.card {
    background: white;
    border-radius: 20px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.card-header h5 {
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

/* Live Indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
    background: rgba(34,197,94,0.1);
    padding: 6px 12px;
    border-radius: 20px;
}

.live-indicator.large {
    font-size: 14px;
    padding: 10px 20px;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Map */
.map-container {
    height: 300px;
    border-radius: 16px;
    overflow: hidden;
}

.large-map-container {
    height: 500px;
}

.gps-leaflet-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border-radius: 0;
}

.dashboard-leaflet-map {
    width: 100%;
    height: 100%;
    min-height: 300px;
}

/* Dashboard Time-in Locations: red circular markers with white "+" */
.leaflet-marker-icon.dashboard-timein-marker,
.dashboard-timein-marker {
    background: none !important;
    background-image: none !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    margin-left: -16px !important;
    margin-top: -16px !important;
}
.dashboard-timein-marker .dashboard-timein-marker-inner {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: #dc2626;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.dashboard-timein-marker .dashboard-timein-plus {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}

/* Active personnel circle markers on map (initials inside circle) */
.leaflet-marker-icon.personnel-circle-marker,
.personnel-circle-marker {
    background: none !important;
    background-image: none !important;
    border: none !important;
    width: 44px !important;
    height: 44px !important;
    margin-left: -22px !important;
    margin-top: -22px !important;
}
.personnel-circle-marker .personnel-circle-inner {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-family: Inter, sans-serif;
    box-sizing: border-box;
}
.personnel-circle-marker.personnel-active .personnel-circle-inner {
    background: #1e3a8a;
}
.personnel-circle-marker.personnel-inactive .personnel-circle-inner {
    background: #6b7280;
}

/* Force personnel initials marker to show (no default pin) */
.leaflet-marker-icon.personnel-initials-marker,
.personnel-initials-marker {
    background: none !important;
    background-image: none !important;
    border: none !important;
}

.map-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.map-placeholder i {
    font-size: 48px;
    color: var(--primary-lighter);
    margin-bottom: 12px;
}

.map-placeholder p {
    font-weight: 600;
    color: var(--primary);
}

.map-placeholder small {
    color: var(--gray-500);
}

.map-markers {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.marker {
    position: absolute;
    width: 36px;
    height: 36px;
    background: var(--gray-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 700;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.marker.active {
    background: var(--success);
}

.marker.large {
    width: 44px;
    height: 44px;
    font-size: 13px;
}

.marker:hover {
    transform: scale(1.15);
    z-index: 10;
}

.marker-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.marker:hover .marker-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Activity */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.activity-icon.time-in,
.activity-icon.check-in { background: rgba(34,197,94,0.1); color: var(--success); }
.activity-icon.time-out,
.activity-icon.check-out { background: rgba(59,130,246,0.1); color: var(--info); }
.activity-icon.location { background: rgba(64,145,108,0.1); color: var(--primary-lighter); }
.activity-icon.alert { background: rgba(245,158,11,0.1); color: var(--warning); }

.activity-text {
    font-size: 14px;
    color: var(--gray-700);
    display: block;
}

.activity-time {
    font-size: 12px;
    color: var(--gray-500);
}

/* Table */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    padding: 16px;
}

.table td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

.guard-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.guard-info img {
    flex-shrink: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--primary);
    overflow: hidden;
}
.avatar img.personnel-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.on-duty { background: rgba(34,197,94,0.1); color: var(--success); }
.status-badge.scheduled { background: rgba(59,130,246,0.1); color: var(--info); }
.status-badge.late { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-badge.complete { background: rgba(64,145,108,0.1); color: var(--primary-lighter); }
.status-badge.active { background: rgba(34,197,94,0.1); color: var(--success); }

.gps-verified {
    color: var(--success);
    font-size: 13px;
}

.gps-pending {
    color: var(--gray-500);
    font-size: 13px;
}

/* Schedule List */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--gray-100);
    border-radius: 12px;
}

.schedule-item .guard-name {
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}

.schedule-item .post {
    flex: 2;
    color: var(--gray-500);
    font-size: 13px;
}

.schedule-item .days {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

/* Personnel Tracking */
.personnel-tracking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tracking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--gray-100);
    border-radius: 12px;
}

.tracking-avatar {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.tracking-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tracking-info .name {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.tracking-info .post {
    font-size: 12px;
    color: var(--gray-500);
}

.tracking-info .coords {
    font-size: 11px;
    color: var(--primary-lighter);
    font-family: monospace;
}

.tracking-status i {
    font-size: 20px;
}

/* Chart Placeholder */
.chart-placeholder {
    height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: 12px;
}

.chart-placeholder i {
    font-size: 48px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.chart-placeholder p {
    color: var(--gray-500);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-navbar {
        padding: 0 16px;
    }
    
    .search-box {
        display: none;
    }
    
    .user-info {
        display: none;
    }
    
    .page-content {
        padding: 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

@media print {
    .sidebar,
    .top-navbar,
    .menu-toggle,
    .nav-menu,
    .page-header .btn,
    #reportsGenerateBtn {
        display: none !important;
    }
    .main-content {
        margin: 0;
        padding: 0;
    }
    .page:not(.active) {
        display: none !important;
    }
    .page.active {
        display: block !important;
    }
}




