/* ==========================================
   CIVIC COMPLAINT TRACKER - COMPLETE CSS
   ========================================== */

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --secondary: #f093fb;
    --success: #00C851;
    --danger: #ff4444;
    --warning: #ffbb33;
    --info: #33b5e5;
    --dark: #212121;
    --light: #f8f9fa;
    --gray: #6c757d;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* ==================== GLOBAL ==================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
    border-radius: 6px;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

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

.btn-success:hover {
    background: #00A040;
}

.btn-info {
    background: var(--info);
    color: white;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-progress {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-resolved {
    background: #d4edda;
    color: #155724;
}

.badge-rejected {
    background: #f8d7da;
    color: #721c24;
}

/* ==================== ANIMATIONS ==================== */

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

/* ==================== ALERTS ==================== */

.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease-out;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* ==================== NAVBAR ==================== */

.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-menu a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-menu a:hover {
    color: var(--primary);
}

/* ==================== FORMS ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.error {
    border-color: var(--danger);
}

.error-message {
    color: var(--danger);
    font-size: 0.85em;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ==================== MODALS ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    color: #333;
    margin: 0;
}

.modal-close {
    font-size: 2em;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ==================== TABLES ==================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

thead {
    background: #f8f9fa;
}

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

th {
    font-weight: 600;
    color: #333;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* ==================== GRID LAYOUTS ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary);
}

.complaints-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* ==================== COMPLAINT CARDS ==================== */

.complaint-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.complaint-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.complaint-card h3 {
    color: #333;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.complaint-card h4 {
    color: #333;
    margin-bottom: 8px;
}

.complaint-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.complaint-card .category {
    display: inline-block;
    padding: 4px 12px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 10px;
}

.complaint-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9em;
    color: #999;
}

/* ==================== MAP LAYOUT ==================== */

.map-container {
    display: flex;
    height: calc(100vh - 70px);
}

#map {
    flex: 1;
    height: 100%;
}

.sidebar {
    width: 400px;
    background: white;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.sidebar-header h2 {
    margin-bottom: 5px;
    font-size: 1.5em;
}

.sidebar-header p {
    opacity: 0.9;
    font-size: 0.9em;
    margin: 0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-section h3 {
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-group {
    margin-bottom: 15px;
}

.search-group label {
    display: block;
    color: #666;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.search-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    transition: border-color 0.3s ease;
}

.search-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.quick-btn {
    padding: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* ==================== ROUTE INFO ==================== */

.route-info {
    padding: 20px;
    background: #f0f4ff;
    border-left: 4px solid var(--primary);
    display: none;
}

.route-info.show {
    display: block;
}

.route-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.route-stat-label {
    color: #666;
    font-weight: 600;
}

.route-stat-value {
    color: #333;
    font-weight: 600;
    font-size: 1.1em;
}

.pothole-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.pothole-warning.show {
    display: block;
}

.pothole-warning h5 {
    color: #856404;
    margin-bottom: 8px;
}

.pothole-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}

.pothole-list li {
    color: #666;
    padding: 6px 0;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.speed-recommendation {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.speed-recommendation.show {
    display: block;
}

.speed-recommendation h5 {
    color: #0c5460;
    margin-bottom: 10px;
}

.speed-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.speed-gauge {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary);
    min-width: 60px;
}

/* ==================== TRACKING ==================== */

.tracking-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: none;
}

.tracking-section.show {
    display: block;
}

.tracking-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.tracking-btn {
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: white;
}

.tracking-btn.start {
    background: var(--success);
}

.tracking-btn.start:hover {
    background: #00A040;
}

.tracking-btn.stop {
    background: var(--danger);
}

.tracking-btn.stop:hover {
    background: #dd3333;
}

.tracking-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: none;
}

.tracking-info.show {
    display: block;
}

.tracking-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #00d4aa;
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.share-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.share-btn {
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: white;
}

.share-whatsapp {
    background: #25d366;
}

.share-whatsapp:hover {
    background: #1fab54;
}

.share-telegram {
    background: #0088cc;
}

.share-telegram:hover {
    background: #0077b5;
}

.share-copy {
    background: #667eea;
}

.share-copy:hover {
    background: #764ba2;
}

/* ==================== LEGEND ==================== */

.legend {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.legend h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.legend-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.legend-marker.pending {
    background: #fff3cd;
}

.legend-marker.progress {
    background: #d1ecf1;
}

.legend-marker.resolved {
    background: #d4edda;
}

.legend-marker.user {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.legend-marker.destination {
    background: #ff6b6b;
    color: white;
}

/* ==================== EMPTY STATES ==================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

/* ==================== LOADING ==================== */

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .share-buttons {
        grid-template-columns: 1fr 1fr;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 10px;
    }
}

@media (max-width: 968px) {
    .map-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 50vh;
    }

    #map {
        height: 50vh;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar-menu {
        flex-direction: column;
        gap: 10px;
    }

    .sidebar {
        height: 40vh;
    }

    #map {
        height: 60vh;
    }

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

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

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

    .modal-content {
        width: 95%;
    }

    .share-buttons {
        grid-template-columns: 1fr;
    }

    .tracking-controls {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}