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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

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

/* Sidebar Styles */

.sidebar {
    width: 280px;
    background: #fff;
    border-radius: 12px;
    margin: 16px 16px 16px 16px;
    padding: 24px 0 24px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    position: fixed;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 24px 32px;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-header h2 {
    color: #1a73e8;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 0 0;
}

.menu-item {
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #5f6368;
    font-weight: 500;
}

.menu-item:hover {
    background-color: #f1f3f4;
    color: #1a73e8;
}

.menu-item.active {
    background-color: #e8f0fe;
    color: #1a73e8;
    border-right: 3px solid #1a73e8;
}

.menu-item i {
    width: 20px;
    text-align: center;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 312px;
    display: flex;
    flex-direction: column;
}

.top-menu {
    background: #fff;
    border-radius: 12px;
    margin: 16px 16px 0;
    padding: 16px 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f1f3f4;
    border-radius: 24px;
    padding: 8px 16px;
    width: 400px;
}

.search-bar i {
    color: #5f6368;
    margin-right: 12px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 14px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: #f1f3f4;
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Content Area */
.content-area {
    flex: 1;
    margin: 16px;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 8px;
}

.page-header p {
    color: #5f6368;
    font-size: 16px;
}

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
}

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
    color: #202124;
    margin-bottom: 4px;
}

.stat-content p {
    color: #5f6368;
    font-size: 14px;
}

.recent-activity {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
}

.recent-activity h2 {
    margin-bottom: 20px;
    color: #202124;
}

/* Rank Statistics Styles */
.rank-stats {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.rank-stats h2 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Upload Styles */
.upload-container {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    border: 2px dashed #dadce0;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #1a73e8;
    background-color: #f8f9ff;
}

.upload-area.dragover {
    border-color: #1a73e8;
    background-color: #e8f0fe;
}

.upload-icon {
    font-size: 48px;
    color: #1a73e8;
    margin-bottom: 20px;
}

.upload-area h3 {
    margin-bottom: 8px;
    color: #202124;
}

.upload-area p {
    color: #5f6368;
    margin-bottom: 24px;
}

.upload-progress {
    margin-top: 24px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: #1a73e8;
    transition: width 0.3s;
    width: 0%;
}

.upload-results {
    margin-top: 24px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-secondary {
    background: #f1f3f4;
    color: #5f6368;
}

.btn-secondary:hover {
    background: #e8eaed;
}

.btn-danger {
    background: #d32f2f;
    color: #fff;
}

.btn-danger:hover {
    background: #b71c1c;
}

/* Ensure subscribe button is red when not subscribed */
.subscribe-btn.btn-danger {
    background: #d32f2f !important;
    color: #fff !important;
}

.subscribe-btn.btn-danger:hover {
    background: #b71c1c !important;
}

.subscribe-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    min-width: 0;
    padding: 8px 14px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.08);
    border-radius: 6px;
}

/* Table Styles */
.officers-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e8eaed;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #202124;
}

tr:hover {
    background: #f8f9fa;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

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

.close {
    color: #5f6368;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #202124;
}

/* Filters */
.filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.filters select,
.filters input {
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        margin: 8px;
    }

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

    .top-menu {
        margin: 8px;
        flex-direction: column;
        gap: 16px;
    }

    .search-bar {
        width: 100%;
    }

    .content-area {
        margin: 8px;
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Alert Styles */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-warning {
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc02;
}

.officers-controls {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-filter {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    width: 250px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e8eaed;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #e8f0fe;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
}

.activity-content p {
    margin: 0;
}

.activity-meta {
    font-size: 12px;
    color: #5f6368;
}

.no-activity {
    text-align: center;
    color: #5f6368;
    padding: 40px 0;
}

.loading {
    text-align: center;
    padding: 40px 0;
    color: #5f6368;
}

#message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

/* Officer Cards Grid */
.officers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.officer-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.5rem 1.2rem 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.2s;
    border: 1px solid #f0f0f0;
}

.officer-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    border-color: #e0e0e0;
}

.officer-card-header {
    position: relative;
    margin-bottom: 1rem;
    color: #1976d2;
}

.officer-card-body {
    text-align: center;
    margin-bottom: 1rem;
}

.officer-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #222;
}

.officer-meta {
    font-size: 0.98rem;
    color: #666;
    margin-bottom: 0.2rem;
}

.officer-card-footer {
    margin-top: auto;
}

.officer-card .btn {
    font-size: 0.95rem;
    padding: 0.4rem 1.1rem;
    border-radius: 6px;
    background: #1976d2;
    color: #fff;
    border: none;
    text-decoration: none;
    transition: background 0.2s;
    display: inline-block;
}

.officer-card .btn:hover {
    background: #125ea2;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0 1rem 0;
    gap: 0.5rem;
}

.pagination-controls button {
    background: #fff;
    border: 1px solid #d0d7de;
    color: #1976d2;
    font-size: 1rem;
    padding: 0.45rem 1.1rem;
    border-radius: 6px;
    margin: 0 0.1rem;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border 0.18s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.pagination-controls button.active,
.pagination-controls button:focus {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
    outline: none;
}

.pagination-controls button:hover:not(.active) {
    background: #f0f6ff;
    color: #125ea2;
    border-color: #b6d4fe;
}

/* Subscription pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0;
    gap: 0.5rem;
}

.pagination button {
    background: #fff;
    border: 1px solid #d0d7de;
    color: #1976d2;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    margin: 0 0.1rem;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border 0.18s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    min-width: 32px;
}

.pagination button.btn-primary {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

.pagination button.btn-secondary {
    background: #fff;
    color: #1976d2;
    border-color: #d0d7de;
}

.pagination button:hover:not(.btn-primary) {
    background: #f0f6ff;
    color: #125ea2;
    border-color: #b6d4fe;
}

#officer-details-content {
    background: #fff;
    color: #222;
    min-height: 200px;
    padding: 2rem 2rem 2rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin: 2.5rem auto;
    max-width: 700px;
    font-size: 1rem;
}

#officer-details-content h2,
#officer-details-content h3 {
    color: #1976d2;
}

#officer-details-content table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

#officer-details-content th,
#officer-details-content td {
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

#officer-details-content th {
    background: #f8f9fa;
    color: #1976d2;
    font-weight: 600;
}

#officer-details-content tr:last-child td {
    border-bottom: none;
}

/* Top search bar styles */
#top-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(60, 72, 88, 0.06);
    padding: 0 12px;
    width: 44px;
    transition: width 0.35s cubic-bezier(.4, 0, .2, 1);
    overflow: visible;
    height: 44px;
    margin-right: 24px;
    border: none;
}

#top-search-bar.expanded {
    width: 320px;
}

#top-search-toggle {
    font-size: 1.2rem;
    color: #888;
    cursor: pointer;
}

#top-search-input {
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    margin-left: 8px;
    width: 100%;
    display: none;
    transition: opacity 0.2s;
    color: #222;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#top-search-bar.expanded #top-search-input {
    display: block;
    opacity: 1;
}

#top-search-suggestions {
    display: none;
    position: absolute;
    left: 0;
    top: 105%;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(60, 72, 88, 0.13);
    z-index: 100;
    max-height: 220px;
    overflow-y: auto;
    font-size: 1rem;
}

#top-search-bar.expanded #top-search-suggestions {
    display: block !important;
}

#top-search-bar {
    border-radius: 24px !important;
}

.top-search-suggestion {
    padding: 12px 20px;
    cursor: pointer;
    color: #222;
    background: transparent;
    font-size: 1rem;
    transition: background 0.12s, color 0.12s;
}

.top-search-suggestion:hover,
.top-search-suggestion.active {
    background: #f5f8fa;
    color: #1a73e8;
}

.top-menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

#top-search-bar {
    margin-left: 0;
}

.user-menu {
    margin-left: auto;
}

.search-suggestion-name {
    font-weight: 600;
    color: #222;
}

.search-suggestion-post {
    color: #888;
    font-size: 0.97em;
    margin-left: 4px;
}

/* Make subscribe button green when subscribed */
.subscribe-btn.btn-secondary {
    background: #388e3c !important;
    color: #fff !important;
}

.subscribe-btn.btn-secondary:hover {
    background: #256029 !important;
}

.officer-name {
    margin-top: 32px;
}

.notification-item {
    transition: background 0.18s, border-left 0.18s;
}

.notification-item:not(.unread):hover {
    background: #f1f8fe !important;
    border-left: 4px solid #90caf9 !important;
}

/* --- MOBILE ENHANCEMENTS --- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 240px;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
        margin: 0;
        border-radius: 0;
    }

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

    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.18);
        z-index: 1999;
    }

    .sidebar-backdrop.active {
        display: block;
    }

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

    .top-menu {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin: 8px;
        padding: 12px 8px;
    }

    .hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        width: 36px;
        height: 36px;
        cursor: pointer;
        margin-right: 12px;
        z-index: 2100;
    }

    .hamburger span {
        display: block;
        height: 4px;
        width: 100%;
        background: #1976d2;
        margin: 4px 0;
        border-radius: 2px;
        transition: all 0.2s;
    }
}

@media (max-width: 600px) {
    .content-area {
        padding: 8px;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 10px;
    }

    .officers-grid {
        gap: 1rem;
        margin-top: 1rem;
    }

    .officer-card {
        padding: 1rem 0.7rem 0.7rem 0.7rem;
    }

    .modal-content {
        width: 98vw;
        max-width: 99vw;
        padding: 0;
    }

    .modal-header,
    .modal-body {
        padding: 12px;
    }

    .filters {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .upload-container {
        max-width: 98vw;
        padding: 0 2vw;
    }

    .upload-area {
        padding: 32px 8px;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        min-height: 44px;
        font-size: 1rem;
        padding: 12px 0;
    }

    table,
    .officers-table {
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {

    .login-form-box,
    .modal-content {
        min-width: 0 !important;
        max-width: 98vw !important;
        padding: 1rem !important;
    }

    .login-form-box input,
    .login-form-box button {
        font-size: 1rem;
        padding: 0.7rem 0.7rem;
    }
}

/* Horizontal scroll for tables on mobile */
@media (max-width: 900px) {

    .officers-table,
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Hide hamburger on desktop */
.hamburger {
    display: none;
}