/* SmartaFel - Stylesheet */

:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #f44336;
    --info: #00BCD4;
    --dark: #333;
    --light: #f5f5f5;
    --gray: #9e9e9e;
    --sidebar-width: 250px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Public Page */
.public-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
}

.header .subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}

.admin-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    transition: background 0.3s;
}

.admin-link:hover {
    background: rgba(255,255,255,0.3);
}

.info-bar {
    background: var(--info);
    color: white;
    padding: 0.75rem 2rem;
}

.info-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters {
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 1rem;
}

.filters select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

#map {
    flex: 1;
    min-height: 500px;
}

.legend {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.legend h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin: 0.25rem 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.severity-low { background: var(--success); }
.severity-medium { background: var(--warning); }
.severity-high { background: #FF5722; }
.severity-critical { background: var(--danger); }

.footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.login-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 1rem;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--primary);
    text-decoration: none;
}

/* Admin Layout */
.admin-page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.2rem;
}

.sidebar-header p {
    font-size: 0.85rem;
    opacity: 0.7;
}

.nav-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
}

.nav-menu li a:hover,
.nav-menu li.active a {
    background: rgba(255,255,255,0.1);
}

.nav-menu li.active a {
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 0.5rem 0;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.sidebar-footer a:hover {
    opacity: 1;
}

.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 1.75rem;
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: var(--dark);
    text-decoration: none;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    line-height: 1;
}

.stat-info p {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Tables */
.table {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--gray);
}

.table tr:hover {
    background: #f9f9f9;
}

.empty-state {
    text-align: center;
    color: var(--gray);
    padding: 2rem !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-new { background: #ffebee; color: #c62828; }
.badge-confirmed { background: #e3f2fd; color: #1565c0; }
.badge-in_progress { background: #fff3e0; color: #ef6c00; }
.badge-resolved { background: #e8f5e9; color: #2e7d32; }

.badge-severity-low { background: #e8f5e9; color: #2e7d32; }
.badge-severity-medium { background: #fff3e0; color: #ef6c00; }
.badge-severity-high { background: #fbe9e7; color: #d84315; }
.badge-severity-critical { background: #ffebee; color: #c62828; }

.badge-level-super { background: #f3e5f5; color: #7b1fa2; }
.badge-level-municipal { background: #e3f2fd; color: #1565c0; }
.badge-level-viewer { background: #eceff1; color: #546e7a; }

.badge-info { background: #e0f7fa; color: #00838f; }

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group.checkbox input {
    width: auto;
}

.form-group.checkbox label {
    margin-bottom: 0;
}

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

.add-form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.add-form h3 {
    margin-bottom: 1rem;
    color: var(--dark);
}

.filters-bar {
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #eee;
    color: var(--dark);
}

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

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

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.inline-form {
    display: inline;
}

/* Report Detail */
.report-detail {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

.info-card,
.action-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.info-card h3,
.action-card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    font-size: 1rem;
    color: var(--gray);
}

.info-card dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
}

.info-card dt {
    font-weight: 500;
    color: var(--gray);
}

.info-card blockquote {
    background: #f5f5f5;
    padding: 1rem;
    border-left: 3px solid var(--primary);
    border-radius: 0 4px 4px 0;
    font-style: italic;
}

.info-card pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    white-space: pre-wrap;
    font-size: 0.9rem;
}

#detail-map {
    height: 200px;
    border-radius: 4px;
}

/* Conversation */
.conversation {
    max-height: 400px;
    overflow-y: auto;
}

.message {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    max-width: 85%;
}

.message-incoming {
    background: #e3f2fd;
    margin-right: auto;
}

.message-outgoing {
    background: #e8f5e9;
    margin-left: auto;
}

.message-time {
    font-size: 0.75rem;
    color: var(--gray);
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 4px solid;
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.category-info h3 {
    margin-bottom: 0.25rem;
}

.category-info p {
    font-size: 0.85rem;
    color: var(--gray);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
}

/* Info Box */
.info-box {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.info-box h4 {
    margin-bottom: 0.5rem;
    color: #1565c0;
}

.info-box ul {
    margin-left: 1.5rem;
}

.info-box li {
    margin: 0.5rem 0;
}

/* Current User Highlight */
.current-user {
    background: #fff8e1 !important;
}

/* Text utilities */
.text-success { color: var(--success); }
.text-muted { color: var(--gray); }

/* Responsive */
@media (max-width: 1024px) {
    .report-detail {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header h2,
    .sidebar-header p,
    .nav-menu li a span,
    .sidebar-footer a span {
        display: none;
    }

    .nav-menu li a {
        justify-content: center;
        padding: 1rem;
    }

    .content {
        margin-left: 60px;
        padding: 1rem;
    }

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

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

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.report-popup {
    min-width: 200px;
}

.report-popup h4 {
    margin: 0 0 0.5rem 0;
    color: var(--dark);
}

.report-popup p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.report-popup .status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}
