@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* --- DESIGN SYSTEM & FARBVARIABLEN --- */
:root[data-theme="light"] {
    --bg-color: #f8fafc;
    --bg-gradient: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.06) 0px, transparent 50%), 
                        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.06) 0px, transparent 50%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(226, 232, 240, 0.9);
    --header-bg: rgba(255, 255, 255, 0.75);
    --text-color: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --badge-bg: #f1f5f9;
}

:root[data-theme="dark"] {
    --bg-color: #0b0f19;
    --bg-gradient: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%), 
                        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.12) 0px, transparent 50%);
    --card-bg: rgba(21, 28, 44, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --header-bg: rgba(11, 15, 25, 0.75);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99, 102, 241, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    --input-bg: #111827;
    --input-border: #1f2937;
    --badge-bg: #1e293b;
}

/* --- RESET & GLOBAL --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem 3rem 1rem;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 960px;
}

/* --- HEADER & NAVBAR --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0.85rem 1.5rem;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 1rem;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.app-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    width: 100%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.925rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-links a:hover {
    color: var(--text-color);
    background-color: var(--primary-light);
}

.nav-links a.active {
    color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 600;
}

/* --- THEME TOGGLE (SONNE / MOND) --- */
.theme-toggle {
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    cursor: pointer;
    width: 40px;
    height: 40px;
    position: relative;
    outline: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.theme-toggle:hover { 
    transform: scale(1.05);
    background: var(--primary-light);
}
.icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
:root[data-theme="dark"] .icon {
    background-color: transparent;
    box-shadow: inset -7px -5px 0 0 #f8fafc;
    transform: rotate(-25deg);
}
:root[data-theme="light"] .icon {
    background-color: #f59e0b;
    box-shadow: none;
    transform: scale(0.9);
}

/* --- CARDS & GLASSMORPHISM --- */
.card {
    background-color: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: var(--shadow-lg);
}

.card h2, .card h3, .card legend, .section-title {
    margin-bottom: 1.25rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-color);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- HERO DASHBOARD CARD --- */
.hero-card {
    text-align: center;
    padding: 3rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%), var(--card-bg);
    border: 1px solid rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.ip-display-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    padding: 0.65rem 1.25rem 0.65rem 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin: 1rem 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ip-display-wrapper:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.ip-address {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.btn-copy {
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.05);
}

/* --- BADGES & STATUS INDICATORS --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-neutral {
    background: var(--badge-bg);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- FORMULARE & INPUTS --- */
fieldset { border: none; margin: 0; padding: 0; }

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input[type="text"], 
input[type="password"], 
input[type="number"], 
input[type="email"], 
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Custom Switch Toggle */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--badge-bg);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--input-border);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* --- BUTTONS --- */
button.btn, a.btn {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

button.btn:hover, a.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
    opacity: 0.95;
}

button.btn:active, a.btn:active {
    transform: translateY(0);
}

button.btn-secondary {
    background: var(--badge-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
}

button.btn-secondary:hover {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

button.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

button.btn-danger:hover {
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-icon-action {
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-icon-action:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* --- TABELLEN --- */
.table-container {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--card-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

th {
    background: var(--badge-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td { border-bottom: none; }

tr {
    transition: background-color 0.15s ease;
}

tr:hover td {
    background-color: var(--primary-light);
}

/* --- ALERTS --- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- GRID LAYOUTS --- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* --- MODAL DIALOGS --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 8px;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--text-color); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 640px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .nav-links {
        justify-content: space-around;
        flex-wrap: wrap;
    }
    
    .ip-address {
        font-size: 1.65rem;
    }
    
    .hero-card {
        padding: 2rem 1rem;
    }
}
