/* Variables & Themes */
:root {
    --bg-dark: #f0f4f8;
    --card-bg: rgba(255, 255, 255, 0.65);
    --border-color: rgba(0, 0, 0, 0.06);
    --input-bg: rgba(255, 255, 255, 0.85);
    
    --primary: hsl(215, 90%, 50%);
    --primary-hover: hsl(215, 90%, 40%);
    --secondary: hsl(175, 90%, 40%);
    --secondary-hover: hsl(175, 90%, 30%);
    
    --text-main: #0f172a;
    --text-muted: #475569;
    
    --success: #0d9488;
    --success-glow: rgba(13, 148, 136, 0.1);
    --warning: #ea580c;
    --warning-glow: rgba(234, 88, 12, 0.1);
    --danger: #e11d48;
    --danger-glow: rgba(225, 29, 72, 0.1);
    
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Glow Background Deco */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.45;
    pointer-events: none;
    animation: glow-float 20s infinite alternate ease-in-out;
}
.bg-glow-1 {
    background: radial-gradient(circle, var(--primary) 0%, rgba(255,255,255,0) 70%);
    top: -200px;
    left: -200px;
}
.bg-glow-2 {
    background: radial-gradient(circle, var(--secondary) 0%, rgba(255,255,255,0) 70%);
    bottom: -200px;
    right: -200px;
    animation-delay: -10s;
}

@keyframes glow-float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 50px) scale(1.15); }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1100px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 10px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.logo:hover {
    transform: scale(1.02);
    opacity: 0.95;
}
.logo h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #0f172a 40%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo h1 span {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ai-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: ai-pulse 2.5s infinite ease-in-out;
}
@keyframes ai-pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(14, 165, 233, 0.3)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 15px rgba(14, 165, 233, 0.6)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(14, 165, 233, 0.3)); }
}
.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Glassmorphism Card Style */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* Main Layout Grid */
.app-main {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}

/* Form Styles */
.section-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.3s ease;
    z-index: 3;
    pointer-events: none;
}
.input-wrapper input,
.input-wrapper select {
    width: 100%;
    background: #ffffff; /* Solid white background for clear contrast against glass card */
    border: 1.5px solid #cbd5e1; /* Clear, visible border */
    border-radius: 12px;
    padding: 14px 16px 14px 44px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}
.input-wrapper input:hover,
.input-wrapper select:hover {
    border-color: #94a3b8; /* Darker border on hover */
}
.input-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}
.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18); /* matching teal theme */
    background: #ffffff;
}
.input-wrapper:focus-within .input-icon {
    color: var(--secondary);
}
input[type="date"] {
    position: relative;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Tabs */
.tab-container {
    display: flex;
    gap: 10px;
    background: #ffffff; /* Solid white background */
    padding: 6px;
    border-radius: 12px;
    border: 1.5px solid #cbd5e1; /* Clear, visible border */
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}
.tab-btn:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.03);
}
.tab-btn.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.grid-2col {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 15px;
}

/* Custom Toggle Switch */
.toggle-group {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: #ffffff; /* Solid white background */
    border: 1.5px solid #cbd5e1; /* Clear, visible border */
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
.toggle-group:hover {
    background: #f8fafc;
    border-color: var(--secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 80%;
}
.toggle-info label {
    cursor: pointer;
}
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.08);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: .4s;
    border-radius: 50%;
}
.toggle-switch input:checked + .slider {
    background-color: var(--secondary);
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}

/* Accordion Guide */
.guide-accordion {
    margin-top: 10px;
    border: 1.5px solid #cbd5e1; /* Clear, visible border */
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff; /* Solid white background */
}
.accordion-trigger {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--secondary);
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}
.accordion-trigger:hover {
    background: rgba(0, 0, 0, 0.02);
}
.accordion-trigger .arrow-icon {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}
.accordion-trigger.active .arrow-icon {
    transform: rotate(180deg);
}
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background: #fafafa; /* Clean off-white background */
}
.accordion-content.open {
    max-height: 500px;
    transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
}
.accordion-content ol {
    padding: 16px 20px 16px 36px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.6;
}
.accordion-content li {
    margin-bottom: 8px;
}
.accordion-content li:last-child {
    margin-bottom: 0;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    box-shadow: 0 4px 20px rgba(100, 200, 255, 0.25);
    transition: all 0.3s ease;
}
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(100, 200, 255, 0.4);
    filter: brightness(1.1);
}
.submit-btn:active {
    transform: translateY(0);
}

/* List Section Styles */
.list-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.list-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.refresh-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--secondary);
    color: var(--secondary);
}
.refresh-btn i {
    transition: transform 0.5s ease;
}
.refresh-btn:active i {
    transform: rotate(360deg);
}

/* Empty State Card */
.empty-card {
    text-align: center;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.empty-icon {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 8px;
}
.empty-card h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
}
.empty-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 300px;
    line-height: 1.5;
}

/* Monitors Grid */
.monitors-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Monitor Card */
.monitor-card {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
}
.monitor-card:hover {
    transform: translateX(4px);
    border-color: var(--secondary);
}

.monitor-status-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

/* Status: Monitoring */
.status-badge.monitoring {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid rgba(225, 29, 72, 0.3);
}
.status-badge.monitoring .dot {
    width: 6px;
    height: 6px;
    background-color: var(--danger);
    border-radius: 50%;
    animation: status-pulse 1.5s infinite;
}
@keyframes status-pulse {
    0% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 8px var(--danger); }
    100% { transform: scale(0.9); opacity: 0.5; }
}

/* Status: Found */
.status-badge.found {
    background: var(--success-glow);
    color: var(--success);
    border: 1px solid rgba(13, 148, 136, 0.3);
    animation: green-glow 2s infinite alternate;
}
@keyframes green-glow {
    0% { box-shadow: 0 0 5px rgba(13, 148, 136, 0.2); }
    100% { box-shadow: 0 0 15px rgba(13, 148, 136, 0.5); }
}

.monitor-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* truncate text safely */
}
.monitor-url {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}
.monitor-url a {
    color: inherit;
    text-decoration: none;
}
.monitor-url a:hover {
    color: var(--secondary);
    text-decoration: underline;
}
.sim-tag {
    font-size: 0.65rem;
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.monitor-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.meta-item i {
    font-size: 0.85rem;
}

.monitor-actions {
    display: flex;
    align-items: center;
}
.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.delete-btn:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Toast Message */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(20, 25, 45, 0.9);
    border: 1px solid var(--secondary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    padding: 16px 24px;
    border-radius: 12px;
    color: #fff;
    z-index: 1000;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}
.toast.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--danger); }

/* Footer */
.app-footer-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
/* Drag and Drop Styling */
.monitor-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    opacity: 0.5;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: opacity 0.2s, color 0.2s;
}
.monitor-drag-handle:hover {
    opacity: 1;
    color: var(--primary);
}
.monitor-drag-handle:active {
    cursor: grabbing;
}
.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary) !important;
    background: rgba(15, 23, 42, 0.05) !important;
}

/* Camping Site Name */
.monitor-camp-name {
    font-family: var(--font-heading);
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.edit-name-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.85rem;
    transition: color 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    opacity: 0.4;
}
.monitor-camp-name:hover .edit-name-btn {
    opacity: 1;
}
.edit-name-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}
.edit-name-input {
    outline: none;
    border: 1.5px solid #cbd5e1; /* Clear, visible border */
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: var(--font-heading);
    font-weight: 700;
    width: 140px;
    background: #ffffff; /* Solid white */
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.edit-name-input:hover {
    border-color: #94a3b8;
}
.edit-name-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 5px rgba(20, 184, 166, 0.25);
}

/* Responsive adjust */
@media (max-width: 600px) {
    .monitor-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 15px;
    }
    .monitor-info {
        align-items: center;
    }
    .monitor-url {
        justify-content: center;
        max-width: 100%;
    }
}

/* Header actions and Mock Camp button */
.app-header {
    position: relative;
}
.header-actions {
    position: absolute;
    right: 0;
    top: 10px;
}
.mock-camp-btn {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white !important;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.25);
    font-family: var(--font-heading);
}
.mock-camp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.45);
    filter: brightness(1.1);
}
.mock-camp-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .header-actions {
        position: static;
        margin-top: 10px;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
    }
}

/* Modal Overlay & Content Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.25s ease;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-content {
    width: 92%;
    max-width: 850px;
    height: 85%;
    max-height: 700px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modal-slide-up {
    from { transform: scale(0.96) translateY(15px); }
    to { transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.close-btn {
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.close-btn:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}
.modal-body {
    flex: 1;
    position: relative;
    padding: 0;
    background: transparent;
}
.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

