:root {
    --ctos-bg: #0a0a0a;
    --ctos-primary: #00f0ff;
    /* Cyan */
    --ctos-secondary: #ff003c;
    /* Red/Glitch */
    --ctos-text: #e0e0e0;
    --ctos-panel: rgba(0, 240, 255, 0.05);
    --font-tech: 'Share Tech Mono', monospace;
}

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

body {
    background-color: var(--ctos-bg);
    color: var(--ctos-text);
    font-family: var(--font-tech);
    overflow-x: hidden;
    height: 100vh;
}

/* Background Grid Effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: -1;
}

/* Centering for Login */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border: 1px solid var(--ctos-primary);
    background: rgba(0, 10, 10, 0.8);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
    position: relative;
    backdrop-filter: blur(5px);
}

/* Decorative Corners */
.login-container::after {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background:
        linear-gradient(to right, var(--ctos-primary) 20px, transparent 20px) 0 0,
        linear-gradient(to right, var(--ctos-primary) 20px, transparent 20px) 0 100%,
        linear-gradient(to bottom, var(--ctos-primary) 20px, transparent 20px) 0 0,
        linear-gradient(to bottom, var(--ctos-primary) 20px, transparent 20px) 100% 0;
    background-size: 20px 20px;
    background-repeat: no-repeat;
    pointer-events: none;
}

.ctos-logo h1 {
    font-size: 2.5rem;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ctos-primary);
    text-shadow: 0 0 10px var(--ctos-primary);
    margin-bottom: 0.5rem;
}

.blink {
    animation: blink 1s infinite;
}

.line {
    height: 2px;
    background: var(--ctos-primary);
    width: 100%;
    margin-bottom: 2rem;
    box-shadow: 0 0 10px var(--ctos-primary);
}

/* Inputs */
.input-group {
    position: relative;
    margin-bottom: 2rem;
}

input[type="password"],
input[type="text"] {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    color: var(--ctos-primary);
    font-family: var(--font-tech);
    font-size: 1.2rem;
    padding: 0.5rem;
    outline: none;
    transition: 0.3s;
}

input:focus {
    border-bottom-color: var(--ctos-primary);
    box-shadow: 0 5px 10px -5px rgba(0, 240, 255, 0.3);
}

/* Button */
button {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--ctos-primary);
    color: var(--ctos-primary);
    font-family: var(--font-tech);
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

button:hover {
    background: var(--ctos-primary);
    color: #000;
    box-shadow: 0 0 20px var(--ctos-primary);
}

.error-message {
    color: var(--ctos-secondary);
    text-align: center;
    margin-bottom: 1rem;
    font-weight: bold;
    text-shadow: 0 0 5px red;
}

.ctos-footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(32px, 9999px, 88px, 0);
    }

    5% {
        clip: rect(54px, 9999px, 21px, 0);
    }

    10% {
        clip: rect(6px, 9999px, 90px, 0);
    }

    100% {
        clip: rect(12px, 9999px, 12px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(12px, 9999px, 5px, 0);
    }

    5% {
        clip: rect(65px, 9999px, 87px, 0);
    }

    10% {
        clip: rect(2px, 9999px, 15px, 0);
    }

    100% {
        clip: rect(45px, 9999px, 34px, 0);
    }
}

/* Dashboard Specifics */
.dashboard {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 300px;
    border-right: 1px solid var(--ctos-primary);
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    z-index: 100;
}

.main-content {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    /* filter: grayscale(100%) invert(100%) contrast(1.2) brightness(0.8); REMOVED */
}

/* Leaflet/Map Overrides for Dark Mode */
.leaflet-container {
    background: #000 !important;
}

/* Tracking List */
.delivery-item {
    position: relative;
    border: 1px solid #333;
    margin-bottom: 1rem;
    padding: 0.5rem;
    transition: 0.2s;
}

.delivery-item:hover {
    border-color: var(--ctos-primary);
    background: var(--ctos-panel);
}

.delivery-item.active {
    border-color: var(--ctos-primary);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.status-badge {
    display: inline-block;
    padding: 2px 5px;
    font-size: 0.7rem;
    border: 1px solid currentColor;
    margin-top: 5px;
}

/* Modal Styling */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: rgba(0, 10, 10, 0.95);
    border: 1px solid var(--ctos-primary);
    width: 90%;
    max-width: 500px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
    position: relative;
    clip-path: polygon(0 0,
            100% 0,
            100% calc(100% - 20px),
            calc(100% - 20px) 100%,
            0 100%);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--ctos-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: var(--ctos-primary);
    font-size: 1.5rem;
    text-shadow: 0 0 5px var(--ctos-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--ctos-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    font-family: var(--font-tech);
}

.close-btn:hover {
    text-shadow: 0 0 5px red;
}

.modal-body label {
    display: block;
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

/* Modal Animation */
@keyframes modalOpen {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content {
    animation: modalOpen 0.2s ease-out;
}

/* Detail Modal Specific */
.detail-modal-content {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.detail-info {
    border: 1px solid #333;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.3);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.detail-label {
    color: #666;
    font-size: 0.85rem;
}

.detail-value {
    color: var(--ctos-primary);
    font-size: 0.85rem;
}

.timeline-header {
    color: var(--ctos-primary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ctos-primary);
}

.detail-timeline {
    max-height: 300px;
    overflow-y: auto;
}

.timeline-item {
    position: relative;
    padding-left: 30px;
    padding-bottom: 1rem;
    border-left: 2px solid #333;
    margin-left: 8px;
}

.timeline-item:last-child {
    border-left-color: transparent;
}

.timeline-item::before {
    content: attr(data-step);
    position: absolute;
    left: -10px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ctos-primary);
    color: #000;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px var(--ctos-primary);
}

.timeline-item.completed::before {
    background: #0f0;
    box-shadow: 0 0 8px #0f0;
}

.timeline-event {
    color: #fff;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.timeline-location {
    color: #888;
    font-size: 0.75rem;
}

.timeline-date {
    color: #666;
    font-size: 0.7rem;
}