:root {
    /* Premium Dark Mode Palette */
    --bg-color: #0f172a; /* Slate 900 */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --surface-color: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --surface-border: rgba(255, 255, 255, 0.1);
    
    --primary: #3b82f6; /* Blue 500 */
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);
    
    --danger: #ef4444; /* Red 500 */
    --success: #10b981; /* Emerald 500 */
    --warning: #f59e0b; /* Amber 500 */
    
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --nav-height: 65px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none !important;
}

/* App Structure */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid var(--surface-border);
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.logo i {
    color: var(--primary);
}

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

.status-indicator {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-indicator.online { color: var(--success); }
.status-indicator.offline { color: var(--warning); }

/* Content Area */
.app-content {
    flex: 1;
    margin-top: var(--header-height);
    margin-bottom: var(--nav-height);
    padding: 20px;
    overflow-y: auto;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--surface-border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    width: 33%;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    transform: translateY(-2px);
}

.floating-btn-wrapper {
    position: relative;
    top: -20px;
}

.floating-btn {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-btn i {
    line-height: 1;
    margin: 0;
    padding: 0;
}

.nav-item.active .floating-btn {
    transform: scale(1.1);
}

/* Views & Animations */
.view {
    animation: fadeIn 0.4s ease forwards;
}

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

.view-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

/* Forms & Inputs */
.form-panel {
    border-radius: var(--radius-lg);
    padding: 20px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--surface-border);
    padding-bottom: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    margin-bottom: 0;
    flex: 1;
}

.form-row.triple .form-group {
    flex: 1;
}

/* Image Previews */
.image-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.preview-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--surface-border);
    background: rgba(0,0,0,0.2);
}

.preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9); /* Red */
    color: white;
    border: none;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.btn-remove-image:hover {
    transform: scale(1.1);
    background: var(--danger);
}

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

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Checkbox Grid for Resources/Members */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.checkbox-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0;
    color: var(--text-main);
    font-size: 0.9rem;
}

.checkbox-grid label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.checkbox-grid label:has(input:checked) {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

/* Material List (with quantity) */
.material-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--surface-border);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--surface-border);
}

/* Login View */
.login-container {
    max-width: 400px;
    margin: 100px auto 0;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.login-header h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tabs & Settings Lists */
.tabs {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 5px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    display: none;
    border-radius: var(--radius-lg);
    padding: 20px;
}

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

.add-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.data-list {
    list-style: none;
}

.data-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--surface-border);
}

.data-list li:last-child {
    border-bottom: none;
}

.delete-btn {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

/* Mission Cards */
.card-grid {
    display: grid;
    gap: 15px;
}

.mission-card {
    padding: 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.mission-card:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.9);
}

.mission-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.mission-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.mission-type.brand { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.mission-type.technik { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.mission-type.gefahrgut { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.mission-type.brandmelder { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.mission-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mission-location {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.mission-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-color);
    backdrop-filter: blur(10px);
    border: 1px solid var(--surface-border);
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: opacity 0.3s, top 0.3s;
}

.notification.success { border-left: 3px solid var(--success); }
.notification.error { border-left: 3px solid var(--danger); }

/* Responsive */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        margin-bottom: 15px;
    }
}

/* Custom Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}
