/* PatrolSync-Inspired Styles */

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

:root {
    --primary-bg: #0f172a;
    --secondary-bg: #1e293b;
    --card-bg: #1e293b;
    --input-bg: #334155;
    --border-color: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --hover-bg: #2d3748;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.app-header {
    background-color: var(--secondary-bg);
    padding: 0.75rem 1rem; /* Reduced padding for smaller header */
    display: flex;
    justify-content: flex-start; /* Align to the left */
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: relative; /* For z-index stacking */
    z-index: 100;
}

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

.menu-toggle-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

/* .logo-img is removed from HTML, keeping the CSS for now in case it's referenced elsewhere, but commenting out the styles */
/*
.logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
*/

/* .header-title h1 removed as title is removed */

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Side Navigation Styles */
.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background-color: var(--secondary-bg);
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 200;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
}

.side-nav.open {
    transform: translateX(0);
}

.side-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.side-nav-logo {
    width: 70px; /* Increased logo size as requested */
    height: 70px;
    margin-right: 0.5rem;
}

.side-nav-header h2 {
    font-size: 1.25rem; /* Base title font size */
    color: var(--text-primary);
    flex-grow: 1;
}

.side-nav-header h2 span {
    font-size: 0.8rem; /* PatrolSync smaller */
    display: block;
    line-height: 1;
}

.side-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Moved h2 styling into the combined .side-nav-header block */

.side-nav .nav-btn {
    width: 100%;
    border-radius: 0;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    background-color: transparent;
    color: var(--text-primary);
    transition: background-color 0.2s, color 0.2s;
}

.side-nav .nav-btn .icon {
    font-size: 1.5rem; /* Larger icon size */
    margin-right: 0.75rem;
}

.side-nav .nav-btn:hover {
    background-color: var(--hover-bg);
    transform: none;
}

.side-nav .nav-btn.active {
    background-color: var(--accent-blue);
    color: white;
}

.side-nav .theme-toggle-btn {
    /* Removed margin-top: auto to keep it with other buttons */
    border-top: 1px solid var(--border-color);
}

/* Main Content Wrapper for Push Effect */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Removed transform transition for push effect */
}

/* Backdrop for overlay effect */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}

.menu-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
}

/* Hamburger button styles removed */

.nav-btn {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

.nav-btn.active {
    background-color: #1e40af;
}

.nav-btn .icon {
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.content-card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

/* Chat container styling remains */

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.draft-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Forms */
.report-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-field.full-width {
    grid-column: 1 / -1;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--text-secondary);
}

.form-field textarea {
    resize: vertical;
    font-family: inherit;
}

.checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-field input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.checkbox-field label {
    margin: 0;
    cursor: pointer;
}

.attachment-group {
    display: flex;
    gap: 0.5rem;
}

.attachment-group input {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--hover-bg);
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Search Filters */
.search-filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Reports Table */
.reports-table-container {
    overflow-x: auto;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.reports-table {
    width: 100%;
    border-collapse: collapse;
}

.reports-table thead {
    background-color: var(--input-bg);
}

.reports-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reports-table tbody tr {
    border-top: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.reports-table tbody tr:hover {
    background-color: var(--hover-bg);
}

.reports-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Empty State */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-content p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Footer */
.app-footer {
    background-color: var(--secondary-bg);
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
    background-color: var(--card-bg);
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--accent-green);
}

.toast.error {
    border-left-color: var(--accent-red);
}

.toast.info {
    border-left-color: var(--accent-blue);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Form Error States */
.form-field.error input,
.form-field.error select,
.form-field.error textarea {
    border-color: var(--accent-red);
}

.error-message {
    color: var(--accent-red);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Prevent horizontal scroll on mobile when menu is open */
    body.menu-open {
        overflow-x: hidden;
    }

    .app-header {
        /* Keep header simple and flat */
        flex-direction: row;
        gap: 0;
        padding: 0.75rem 1rem;
    }

    /* Remove old header-nav styles */
    .nav-btn {
        /* Reset nav-btn for mobile, they will be styled by side-nav */
        width: auto;
        margin-bottom: 0;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    .content-card {
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .main-content {
        padding: 1rem;
    }

    .content-card {
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header-title h1 {
        /* Title removed */
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .nav-btn {
        font-size: 0.75rem; /* Reduced font size for smaller screens */
        padding: 0.5rem 0.75rem;
    }

    .nav-btn .icon {
        display: inline-block;
    }
}


/* Light Mode Styles */
.light-mode {
    --primary-bg: #f8fafc; /* Slate 50 */
    --secondary-bg: #ffffff; /* White */
    --card-bg: #ffffff; /* White */
    --input-bg: #f1f5f9; /* Slate 100 */
    --border-color: #e2e8f0; /* Slate 200 */
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --hover-bg: #e2e8f0; /* Slate 200 */
}

.light-mode .nav-btn {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.light-mode .nav-btn:hover {
    background-color: var(--hover-bg);
    transform: none;
}

.light-mode .nav-btn.active {
    background-color: var(--accent-blue);
    color: white;
}

.light-mode .btn-secondary {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.light-mode .btn-secondary:hover {
    background-color: var(--border-color);
}

.light-mode .reports-table thead {
    background-color: var(--hover-bg);
}

.light-mode .reports-table tbody tr:hover {
    background-color: var(--input-bg);
}

/* Chat View Styles */
.chat-container {
    display: flex;
    height: 70vh; /* Set a fixed height for the chat area */
    min-height: 500px;
    padding: 0;
    overflow: hidden;
}

.chat-sidebar {
    width: 300px;
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-sidebar h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.officer-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.officer-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    color: var(--text-primary);
}

.officer-item:hover {
    background-color: var(--hover-bg);
}

.officer-item.selected {
    background-color: var(--accent-blue);
    color: white;
}

.officer-item.selected .status {
    background-color: white !important;
}

.status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.status.online {
    background-color: var(--accent-green);
}

.status.busy {
    background-color: var(--accent-yellow);
}

.status.offline {
    background-color: var(--text-secondary);
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-messages {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-input-area {
    display: flex;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
}

.chat-input-area textarea {
    flex-grow: 1;
    resize: none;
    height: 40px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.chat-input-area button {
    flex-shrink: 0;
}

/* Chat Message Bubble Styles (Placeholder) */
.message-bubble {
    max-width: 70%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    line-height: 1.4;
}

.message-bubble.sent {
    align-self: flex-end;
    background-color: var(--accent-blue);
    color: white;
    border-bottom-right-radius: 0;
}

.message-bubble.received {
    align-self: flex-start;
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 0;
}

.message-bubble .sender {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Responsive adjustments for Chat */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .officer-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        max-height: 150px;
    }

    .officer-item {
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--border-color);
    }

    .chat-main {
        min-height: 400px;
    }
}
