/* ========================================
   1. RESET & BASE STYLES
========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Define our App Colors - THIS WAS MISSING! */
:root {
    --deep-blue: #0a2540;
    --vibrant-pink: #ff477e;
    --pink-hover: #e0366b;
    --success-green: #2ecc71;
    --danger-red: #e74c3c;
    --card-bg: #ffffff;
}

body {
    font-family: 'Poppins', sans-serif;
    /* ✨ NEW VIBRANT BACKGROUND: A beautiful blend of soft purple and blue */
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    background-attachment: fixed; /* Keeps the background perfectly still if you scroll */
    min-height: 100vh; /* Ensures the color reaches the very bottom of the screen */
    color: #333;
}

/* =========================================
   2. TOP NAVIGATION BAR
========================================= */
.navbar {
    background-color: var(--deep-blue);
    color: white;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.brand-titles h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.brand-titles p {
    font-size: 0.85rem;
    color: #a0b2c6;
    margin-top: -2px;
}

.nav-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* =========================================
   3. GLOBAL BUTTON STYLES
========================================= */
button {
    font-family: 'Poppins', sans-serif;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
}

/* Specific Buttons */
.wallet-btn {
    background-color: var(--vibrant-pink);
    color: white;
}
.wallet-btn:hover { background-color: var(--pink-hover); }

.track-btn {
    background-color: #34495e;
    color: white;
}

.sos-btn {
    background-color: var(--danger-red);
    color: white;
    animation: pulse 1.5s infinite;
}

/* =========================================
   4. 3-BOX DASHBOARD (FEATURES GRID)
========================================= */
.app-container {
    padding: 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    /* This magically makes it 3 columns on PC, and 1 column on Mobile! */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.feature-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(10, 37, 64, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(10, 37, 64, 0.15);
}

.box-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #f4f7f9;
    padding-bottom: 10px;
}

.box-icon {
    font-size: 1.5rem;
}

.feature-box h3 {
    color: var(--deep-blue);
    font-size: 1.2rem;
    margin: 0;
}

.box-desc {
    font-size: 0.9rem;
    color: #7f8c8d;
    flex-grow: 1; /* Pushes buttons to the bottom evenly */
    margin: 0;
}

/* --- Box 1 Specifics --- */
.search-bar {
    display: flex;
    gap: 10px;
    width: 100%;
}

#search-input {
    flex-grow: 1;
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid #dfe6e9;
    font-family: 'Poppins', sans-serif;
    outline: none;
    background: #f8f9fa;
}

#search-input:focus {
    border-color: var(--vibrant-pink);
    background: white;
}

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

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    background-color: #ecf0f1;
    color: var(--deep-blue);
    padding: 8px 12px;
    font-size: 0.85rem;
}

.filter-btn:hover {
    background-color: var(--deep-blue);
    color: white;
}

/* --- Box 2 & 3 Specifics --- */
.action-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.add-btn-new {
    background-color: var(--vibrant-pink);
    color: white;
    flex: 1;
}

.sync-btn {
    background-color: #f39c12;
    color: white;
    flex: 1;
}

.status-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    color: #95a5a6;
    text-align: left;
}

/* Special styling for the SOS Box */
.sos-box {
    border: 2px solid rgba(231, 76, 60, 0.2);
    background: linear-gradient(to bottom right, rgba(255,255,255,0.95), rgba(253, 237, 236, 0.95));
}

.sos-btn {
    flex: 1;
    background-color: var(--danger-red);
    color: white;
    animation: pulse 1.5s infinite;
}

.track-btn {
    flex: 1;
    background-color: #34495e;
    color: white;
}
/* =========================================
   5. MAP & FLOATING UI
========================================= */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 65vh;
    border-radius: 15px;
    overflow: hidden; 
    /* ✨ NEW: Adds a crisp white frame and a pink/blue glowing shadow */
    border: 4px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 35px rgba(255, 71, 126, 0.2), 0 5px 15px rgba(10, 37, 64, 0.2);
}

#map {
    height: 100%;
    width: 100%;
}

.fab-btn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background-color: var(--vibrant-pink);
    color: white;
    padding: 15px 25px;
    font-size: 1.1rem;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(255, 71, 126, 0.4);
}

/* Add Form Card Overlay */
.map-overlay-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 320px;
    border: 1px solid rgba(255,255,255,0.5);
}

.map-overlay-card h3 {
    margin-bottom: 15px;
    color: var(--deep-blue);
    text-align: center;
}

.map-overlay-card input, .map-overlay-card select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    outline: none;
}

.address-row {
    display: flex;
    gap: 10px;
}

.find-btn {
    background-color: #9b59b6;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
}

.map-hint {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.save-btn {
    flex: 1;
    background-color: var(--success-green);
    color: white;
    border-radius: 8px;
}

.cancel-btn {
    flex: 1;
    background-color: var(--danger-red);
    color: white;
    border-radius: 8px;
}

.hidden {
    display: none !important;
}

/* =========================================
   6. MAP POPUPS
========================================= */
.popup-content {
    text-align: left;
    font-family: 'Poppins', sans-serif;
}

.popup-content b {
    font-size: 1.2rem;
    color: var(--deep-blue);
    display: block;
    margin-bottom: 5px;
}

.rating-stars {
    color: #f1c40f; 
    font-size: 1.1em;
    margin: 8px 0;
    background: #fff9e6;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
}

.rate-btn {
    background: var(--vibrant-pink);
    color: white;
    padding: 6px 12px;
    font-size: 0.85em;
    margin-top: 10px;
    border-radius: 15px;
    width: 100%;
}

/* =========================================
   7. ANIMATIONS & RESPONSIVE DESIGN
========================================= */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 15px 10px rgba(231, 76, 60, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

@media (max-width: 900px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .dashboard {
        flex-direction: column;
        align-items: stretch;
    }
    .search-bar {
        max-width: 100%;
    }
    .filters {
        justify-content: center;
    }
    .nav-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    .status-indicator {
        text-align: center;
    }
}
.audit-trail-container {
    margin-top: 25px;
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.audit-header {
    background: var(--deep-blue);
    color: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-header h3 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

.live-pulse {
    color: var(--success-green);
    font-size: 0.9rem;
    font-weight: bold;
    animation: blink 2s infinite;
}

.audit-logs {
    padding: 15px 25px;
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa; /* Slight gray to look like a log feed */
    font-family: 'Courier New', Courier, monospace; /* Techy font! */
    font-size: 0.85rem;
}

.log-entry {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 5px;
    animation: slideDown 0.3s ease-out;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-hash a {
    color: var(--vibrant-pink);
    text-decoration: none;
    font-weight: bold;
    background: rgba(255, 71, 126, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.log-hash a:hover {
    text-decoration: underline;
    background: rgba(255, 71, 126, 0.2);
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

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