/* 
 * ProCiv Private Section Styles
 * Consolidated from individual HTML files
 */

/* --- FONTS --- */
@import url('../../lib/fonts/fonts.css');

/* --- PAGE TRANSITION SCREEN --- */
/* Prevents flash of mobile menu during page navigation */
#page-transition-overlay {
    position: fixed;
    inset: 0;
    background-color: #000000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-out;
}

#page-transition-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#page-transition-overlay .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- GLOBAL BODY --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #000000;
    color: #e5e5e5;
    /* specific to geophoto implies this, others use text-neutral-200 which is similar */
}

/* --- PAGE SPECIFIC BODY OVERRIDES --- */
body.auth-page {
    font-family: 'Manrope', sans-serif;
    overflow: hidden;
    position: relative;
    transition: background-color 1s ease;
}

body.map-page {
    background-color: #1a1a1a;
    overflow: hidden;
}

/* --- COMMON UTILITIES --- */

/* Glassmorphism Panel (Managers) */
.glass-panel {
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #333;
}

/* Dark Input Fields */
.input-dark {
    background-color: #0a0a0a;
    border: 1px solid #333;
    color: #fff;
    transition: border-color 0.3s ease;
}

.input-dark:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Table Interactions */
.table-row-hover:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Dark Date Picker */
.date-dark::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.date-dark::-webkit-datetime-edit {
    color: #a3a3a3;
}

.date-dark::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

/* Skeleton Loading */
.skeleton {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #111;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* --- AUTH PAGES (Login / ChangePassword) --- */

.glow-orb {
    position: absolute;
    border-radius: 50%;
    z-index: 0;
    opacity: 0.7;
    mix-blend-mode: screen;
    animation: floatOrb 5s infinite ease-in-out alternate;
    transition: transform 1.5s cubic-bezier(0.7, 0, 0.3, 1), opacity 1.5s ease;
}

.orb-1 {
    top: -10%;
    left: 10%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.3) 0%, rgba(0, 0, 0, 0) 70%);
    animation-duration: 7s;
}

.orb-2 {
    bottom: -10%;
    right: 0%;
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    animation-duration: 9s;
    animation-delay: -2s;
}

.orb-3 {
    top: 40%;
    left: -20%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
    animation-duration: 6s;
    animation-delay: -3s;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(60px, 60px);
    }
}

.stealth-input {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.stealth-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.stealth-input:focus {
    background-color: #000000;
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
    outline: none;
}

.stealth-input.input-error {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.1);
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.error-msg {
    height: 0;
    overflow: hidden;
    color: #ef4444;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0;
    opacity: 0;
    transition: all 0.3s ease;
    padding-left: 4px;
}

.error-msg.visible {
    height: 20px;
    margin-top: 8px;
    opacity: 1;
}

.btn-void {
    background: rgba(255, 255, 255, 0.95);
    color: #000000;
    border: 1px solid #ffffff;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 20;
}

.btn-void:hover {
    background: #000000;
    color: #ffffff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.loader-dots {
    display: none;
}

.loader-dots div {
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loader-dots div:nth-child(1) {
    left: 8px;
    animation: loader-dots1 0.6s infinite;
}

.loader-dots div:nth-child(2) {
    left: 8px;
    animation: loader-dots2 0.6s infinite;
}

.loader-dots div:nth-child(3) {
    left: 32px;
    animation: loader-dots2 0.6s infinite;
}

.loader-dots div:nth-child(4) {
    left: 56px;
    animation: loader-dots3 0.6s infinite;
}

@keyframes loader-dots1 {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes loader-dots3 {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(0);
    }
}

@keyframes loader-dots2 {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(24px, 0);
    }
}

.icon-fade {
    opacity: 0.5;
    transition: opacity 0.3s;
    color: rgba(255, 255, 255, 0.6);
}

.group:focus-within .icon-fade {
    opacity: 1;
    color: white;
}

.glass-dark {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
    transition: transform 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045), opacity 0.8s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

body.success-state {
    background-color: #ffffff !important;
}

body.success-state .glass-dark {
    transform: scale(0) rotate(5deg);
    opacity: 0;
    filter: blur(20px);
}

body.success-state .glow-orb {
    transform: scale(3) !important;
    opacity: 0;
    filter: blur(0px);
}

body.success-state .glow-orb.orb-1 {
    transition-delay: 0.1s;
}

body.success-state .glow-orb.orb-2 {
    transition-delay: 0.2s;
}

body.success-state .glow-orb.orb-3 {
    transition-delay: 0s;
}

.glass-dark.access-denied {
    animation: denied-shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
    border-color: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 30px rgba(220, 38, 38, 0.2);
}

@keyframes denied-shake {

    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(4px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-6px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(6px, 0, 0);
    }
}

/* --- DASHBOARD (MainPrivate) --- */

.minimal-card {
    background-color: rgba(20, 20, 20, 0.6);
    border: 1px solid #333;
    transition: all 0.4s ease;
}

.minimal-card:hover {
    border-color: #555;
    background-color: rgba(30, 30, 30, 0.8);
    transform: translateY(-2px);
}

.card-hydro:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.glow-text {
    transition: text-shadow 0.3s ease;
}

.minimal-card:hover .glow-text {
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.pulse-glow {
    animation: pulse-text-shadow 1.5s infinite ease-in-out alternate;
}

@keyframes pulse-text-shadow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(var(--alert-color-rgb), 0.7);
    }

    50% {
        text-shadow: 0 0 30px rgba(var(--alert-color-rgb), 1);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce-slow {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

@keyframes count {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-bounce-slow {
    animation: bounce-slow 4s ease-in-out infinite;
}

.animate-count {
    animation: count 1s ease-out;
}

/* --- MAP MANAGER --- */

/* Glass Panel for Map Sidebar overrides generic if needed, or reuses it. 
   MapManager defines .glass-panel with specific box-shadow and blur. 
   The generic one is very similar. We'll use the generic one. 
*/

.tool-btn {
    transition: all 0.2s ease;
    background-color: rgba(20, 20, 20, 0.3);
    border: 2px solid transparent;
    border-radius: 0.75rem;
    padding: 0.5rem;
}

.tool-btn:hover {
    background-color: rgba(50, 50, 50, 0.8);
    transform: translateY(-1px);
}

.tool-btn.active[data-tool="meeting-point"] {
    background-color: rgba(6, 182, 212, 0.2);
    border-color: #06b6d4;
    color: #06b6d4;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.tool-btn.active[data-tool="road-closed"] {
    background-color: rgba(220, 38, 38, 0.2);
    border-color: #dc2626;
    color: #dc2626;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.3);
}

.tool-btn.active[data-tool="warning"] {
    background-color: rgba(234, 179, 8, 0.2);
    border-color: #eab308;
    color: #eab308;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.3);
}

.tool-btn.active[data-tool="accident"] {
    background-color: rgba(168, 85, 247, 0.2);
    border-color: #a855f7;
    color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.tool-btn.active[data-tool="draw"] {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.tool-btn.delete-mode {
    border-color: #ef4444;
    color: #ef4444;
}

.tool-btn.delete-mode.active {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Touch optimization for toolbar buttons */
.tool-btn,
#delete-btn {
    touch-action: manipulation;
    /* Removes 300ms tap delay */
    -webkit-tap-highlight-color: transparent;
    /* Removes blue highlight on iOS */
}

.first-vertex-custom-icon {
    background-color: #06b6d4;
    border: 2px solid white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.8);
    animation: pulse-cyan 1.5s infinite;
}

@keyframes pulse-cyan {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
    }

    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

.custom-div-icon {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 40px;
    height: 40px;
    border-radius: 50% 50% 50% 0;
    background: #3b82f6;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
}

.marker-pin svg {
    transform: rotate(45deg);
    z-index: 10;
    color: #fff;
}

.pin-meeting-point {
    background-color: #06b6d4;
}

.pin-road-closed {
    background-color: #dc2626;
}

.pin-warning {
    background-color: #eab308;
}

.pin-accident {
    background-color: #a855f7;
}

/* --- GEOPHOTO --- */
#pwa-warning {
    display: none;
}

.hidden {
    display: none;
}

.pulse-ring {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.pulse-green {
    animation: pulse-green-anim 2s infinite;
}

@keyframes pulse-green-anim {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* --- STYLE POPUP --- */
#style-popover {
    position: absolute;
    right: 175%;
    /* Left of parent */
    top: 50%;
    transform: translateY(-50%);
    width: 260px;
    /* Fixed width */
    margin-right: 1rem;
    background-color: #171717;
    /* neutral-900 */
    border: 1px solid #3f3f46;
    /* zinc-700 */
    border-radius: 0.75rem;
    /* rounded-xl */
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
    z-index: 2000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#style-popover.show {
    display: grid;
}

.style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: #e5e5e5;
    background: transparent;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

.style-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #525252;
}

.style-preview-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    position: relative;
    overflow: hidden;
    border: 2px solid #525252;
}

.style-label {
    font-size: 0.625rem;
    /* text-[10px] */
    color: #d4d4d4;
    /* neutral-300 */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- MISSION POPUP THEME --- */
.maplibregl-popup-content {
    background: #171717 !important;
    /* neutral-900 */
    border: 1px solid #3f3f46;
    /* zinc-700 */
    border-radius: 0.75rem !important;
    /* rounded-xl */
    padding: 0 !important;
    color: white;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4) !important;
}

.maplibregl-popup-tip {
    border-top-color: #171717 !important;
    border-bottom-color: #171717 !important;
}

.maplibregl-popup-close-button {
    color: #a3a3a3;
    font-size: 1.2rem;
    padding: 4px 8px;
    top: 4px;
    right: 4px;
}

.maplibregl-popup-close-button:hover {
    color: white;
    background: transparent;
}