/* ===================================================================
   CityZen Report Page - Upgraded V3
   =================================================================== */

/* --- NEW --- Added a global box-sizing reset */
* {
    box-sizing: border-box;
}

/* 1. GLOBAL STYLES & VIBRANT THEME
   =================================================================== */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --input-bg-color: #f8fafc;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --danger-color: #e11d48; /* Modern rose for recording */
    
    /* --- REMOVED --- --gradient-primary is no longer needed */

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.07);
    --shadow-soft: 0 4px 10px rgba(0,0,0,0.05);
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. LAYOUT & CONTAINER STYLING
   =================================================================== */
.container {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px 50px;
    width: 95%;
    max-width: 1200px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-top: 70px;
    position: relative;
    border: 1px solid var(--border-color);
}

.report-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: flex-start;
    margin-top: 2rem;
}

.map-container {
    position: sticky;
    top: 20px;
}

#map {
    height: 500px;
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    z-index: 1;
    box-shadow: var(--shadow-soft);
}

/* 3. TYPOGRAPHY & HEADER
   =================================================================== */
h2 {
    font-size: 2.25rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
    font-weight: 700;
    animation: slide-fade-in 0.8s ease-out;
}
h2 span {
    color: var(--primary-color);
}

/* 4. FORM STYLING
   =================================================================== */
.form-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    text-align: left;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

.input-group label {
    font-size: 0.875rem;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--input-bg-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    color: var(--text-dark);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
    background-color: #fff;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* 5. INTERACTIVE ELEMENTS (Buttons, Voice Recorder)
   =================================================================== */
.btn-group {
    grid-column: 1 / -1;
    display: flex;
    gap: 16px;
    justify-content: flex-start;
    margin-top: 20px;
}

.btn, .btn-outline, .btn-location {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
}

.btn {
    /* --- CHANGED --- Swapped gradient for fixed color */
    background-color: var(--primary-color);
    color: #fff;
}
.btn:hover {
    /* --- CHANGED --- Added hover color and kept transform */
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-dark);
}
.btn-outline:hover {
    background-color: var(--input-bg-color);
    border-color: var(--text-light);
    color: var(--primary-color);
}

.btn-location {
    background: var(--input-bg-color);
    border-color: var(--border-color);
    color: var(--primary-color);
    width: 100%;
    margin-bottom: 8px;
}
.btn-location:hover {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.voice-recorder {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px;
    background-color: var(--input-bg-color);
    border-radius: 10px;
}

.record-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

.record-btn.recording {
    background-color: var(--danger-color);
    animation: pulse 1.5s infinite;
}

.timer {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 50px;
}

#audioPlayback { width: 100%; height: 40px; }
#audioPlayback.hidden, .record-btn.hidden, .timer.hidden { display: none; }
.hidden { display: none; }

/* File Input */
.input-group input[type="file"] {
    border: 1px solid var(--border-color);
    padding: 10px;
}
.input-group input[type="file"]::-webkit-file-upload-button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-right: 10px;
}
.input-group input[type="file"]::-webkit-file-upload-button:hover { background: var(--primary-hover); }

/* --- NEW --- 6. FLASH MESSAGES (Moved from HTML)
   =================================================================== */
#flash-container {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 9999;
    width: 350px;
    max-width: 90%;
}

.flash-message {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    color: #fff;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: fadeInRight 0.5s ease-out forwards;
}

/* Categories */
.flash-message.flash-warning { background-color: #f0ad4e; }
.flash-message.flash-success { background-color: #5cb85c; }
.flash-message.flash-danger  { background-color: #d9534f; }
.flash-message.flash-info    { background-color: #5bc0de; }

/* Animations for Flash */
.flash-message.fade-out {
    animation: fadeOutRight 0.5s ease-in forwards;
}

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

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


/* 7. MISCELLANEOUS & RESPONSIVE
   =================================================================== */
.home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    text-decoration: none;
    background: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    z-index: 10;
}
.home-btn:hover { background: var(--input-bg-color); transform: translateY(-2px); }
.home-icon { margin-right: 6px; }

footer { text-align: center; font-size: 0.875rem; color: var(--text-light); margin: 40px 0 20px; }

/* Animations */
.fade-in-up { opacity: 0; transform: translateY(20px); animation: fadeInUp 0.8s ease forwards; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

@keyframes slide-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7); }
    70% { box-shadow: 0 0 0 12px rgba(225, 29, 72, 0); }
    100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.3;
    z-index: -1;
    animation: float 25s ease-in-out infinite;
}
.shape1 { width: 450px; height: 450px; background: #a5b4fc; top: -150px; left: -150px; animation-duration: 25s; }
.shape2 { width: 400px; height: 400px; background: #6ee7b7; bottom: -150px; right: -150px; animation-duration: 20s; animation-delay: 5s; }
.shape3 { width: 350px; height: 350px; background: #f9a8d4; top: 40%; right: 20%; animation-duration: 30s; animation-delay: 10s; }
@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, 40px) rotate(45deg); }
    50% { transform: translate(-30px, -10px) rotate(90deg); }
    75% { transform: translate(40px, -30px) rotate(135deg); }
    100% { transform: translate(0, 0) rotate(180deg); }
}

@media (max-width: 992px) {
    .report-layout { grid-template-columns: 1fr; }
    .map-container { 
        position: static; 
        margin-top: 30px; 
        /* --- CHANGED --- Removed 'order: -1' to keep form on top */
    } 
    #map { height: 300px; }
}

@media (max-width: 768px) {
    body { padding: 0; } /* Full width on mobile */
    .container {
        width: 100%;
        max-width: 100%;
        padding: 30px 20px;
        margin-top: 0;
        border-radius: 0;
        box-shadow: none;
        border: none; /* --- NEW --- Removed border for a cleaner edge-to-edge look */
    }
    h2 { font-size: 1.75rem; }
    .form-card { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; gap: 12px; }
}