/* app/static/css/main.css */

/* ==========================================================================
   Basis
   ========================================================================== */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

main {
    /* Automatische Anpassung an die Navbar-Höhe + 20px Abstand */
    padding-top: calc(var(--nav-height) + 20px);
    padding-left: 1px;
    padding-right: 1px;
    padding-bottom: 1px;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
}

/* ==========================================================================
   Header & Navigation (Vollständig)
   ========================================================================== */
.navbar {
    background-color: var(--bg-navbar);
    color: var(--text-main);
    /* padding: 1rem 0; <- Entfernt oder angepasst, da Höhe jetzt fixiert ist */
    min-height: var(--nav-height);
    display: flex;
    align-items: center; /* Vertikal zentrieren */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0px 2px 10px var(--shadow-color);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
  
.navbar .container {
    width: 100%; /* Container soll volle Breite der Navbar nutzen */
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { 
    color: var(--text-main); 
    font-size: 1.5rem; 
    font-weight: bold; 
    display: flex; /* Damit das Bild sauber sitzt */
    align-items: center;
}

/* NEU: Bildgröße über CSS steuern */
.logo img {
    height: 120px;
    width: auto;
}

/* Desktop Nav Links */
.nav-links { 
    list-style: none; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    gap: 2rem; 
    align-items: center;
}

.nav-links a { 
    color: var(--text-main); 
    font-weight: bold; 
    transition: color 0.2s ease; 
}

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

/* Dropdown Container */
.dropdown { 
    position: relative; 
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
}

.dropdown-toggle:hover {
    background-color: var(--bg-secondary);
}

/* Dropdown Arrow */
.dropdown-arrow {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform 0.3s ease;
}

/* Dropdown Menü (Das Popup) */
.dropdown-menu {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 20px var(--shadow-color);
    position: absolute; 
    top: 100%; 
    left: 0; 
    min-width: 200px; 
    border-radius: 6px; 
    opacity: 0; 
    visibility: hidden; 
    transform: translateY(-10px); 
    transition: all 0.3s ease; 
    margin-top: 8px; 
    z-index: 1000;
    padding: 10px 0;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-main);
}

.dropdown-menu a:hover {
    background-color: var(--bg-secondary);
    color: var(--color-primary);
}

/* Desktop Hover Logic */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .dropdown:hover .dropdown-arrow {
        transform: rotate(180deg);
    }
}

/* Profile Dropdown Special Style */
.profile-dropdown .dropdown-toggle {
    background-color: var(--color-success);
    color: #1a1a1a !important;
    padding: 5px 12px;
    border-radius: 4px;
}
.profile-dropdown .dropdown-toggle:hover {
    opacity: 0.9;
}

/* Hamburger Menu (Default versteckt) */
.hamburger { display: none; cursor: pointer; }
.hamburger span { 
    display: block; 
    width: 25px; 
    height: 3px; 
    background-color: var(--text-main); 
    margin-bottom: 5px; 
}

/* ==========================================================================
   Mobile Responsive Navigation
   ========================================================================== */
@media (max-width: 768px) {
    /* Auf Mobile evtl. weniger Abstand oben */
    main {
        padding-top: var(--nav-height);
    }

    .hamburger { display: block; }
    
    .nav-links {
        position: fixed; 
        top: var(--nav-height); /* Nutzt jetzt die Variable */
        left: 0; 
        width: 100%; 
        height: calc(100vh - var(--nav-height));
        background-color: var(--bg-navbar); 
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        border-top: 1px solid var(--border-color);
        transform: translateY(-110%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
    }
    
    .nav-links.open { 
        transform: translateY(0); 
    }
    
    .dropdown { 
        width: 100%; 
    }
    
    .dropdown-menu { 
        position: static;
        opacity: 1; 
        visibility: visible; 
        transform: none; 
        margin-top: 0; 
        box-shadow: none; 
        background: transparent; 
        border: none; 
        margin-left: 20px; 
        margin-bottom: 10px; 
        display: none;
    }
}

/* ==========================================================================
   Cards & Content
   ========================================================================== */
.page-container { padding: 30px; max-width: 1600px; margin: 0 auto; }
.top-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 30px; margin-bottom: 40px; }

.info-card, .status-card { 
    background: var(--bg-card); 
    border-radius: 16px; 
    border: 1px solid var(--border-color); 
    padding: 25px; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 4px 20px var(--shadow-color); 
}

.card-header { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.card-header .icon { font-size: 1.5rem; color: var(--color-primary); }
.card-header h2 { font-size: 1.3rem; color: var(--text-main); font-weight: 500; margin: 0; }
.card-content { flex-grow: 1; overflow: hidden; }

/* Spezielle Cards */
.hero-ip-card { 
    grid-column: 1 / -1; text-align: center; padding: 30px; 
    background: var(--hero-gradient);
}
.hero-ip-card h1 { color: var(--text-muted); }

.ip-display-area { 
    display: flex; align-items: center; justify-content: center; gap: 15px; 
    background: var(--ip-display-bg); 
    padding: 20px; border-radius: 12px; border: 1px solid var(--border-color);
}
.ip-display-text { 
    font-family: 'Courier New', Courier, monospace; font-size: 2.5rem; font-weight: bold; 
    background: var(--ip-text-gradient); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
}

.info-item { display: flex; justify-content: space-between; padding: 10px 0; font-size: 0.9rem; }
.info-item + .info-item { border-top: 1px solid var(--border-color); }
.info-item .key { color: var(--text-muted); }
.info-item .value { color: var(--text-main); }

.provider-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;        /* Feste Breite */
    height: 200px;       /* Feste Höhe */
    margin-right: 15px; /* Abstand zwischen Logo und Text */
    flex-shrink: 0;     /* Verhindert Schrumpfen auf Mobile */
    text-decoration: none;
    transition: transform 0.2s ease;
}

/* Hover Effekt für das Logo */
.provider-logo-link:hover {
    transform: scale(1.05);
}

/* Das Bild selbst */
.uniform-logo {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Behält das Seitenverhältnis bei */
    object-position: center;
}

/* Header Ausrichtung */
.card-header-custom {
    display: flex;
    align-items: center;
}


/* ==========================================================================
   Buttons & Forms
   ========================================================================== */
.copy-button, .form-button { 
    background: transparent; 
    border: 1px solid var(--border-color); 
    color: var(--text-muted); 
    padding: 10px 20px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; font-size: 1rem; 
}
.copy-button:hover, .form-button:hover { 
    border-color: var(--color-primary); 
    color: var(--color-primary); 
}

.form-button-primary, .btn-primary {
    background: linear-gradient(145deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    border: none;
}
.form-button-primary:hover, .btn-primary:hover {
    opacity: 0.9;
    color: white;
}

input, select, textarea {
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    width: 100%; 
    box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ==========================================================================
   Theme Toggle Button
   ========================================================================== */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.2rem;
    margin-left: 15px;
    transition: all 0.3s ease;
}
.theme-toggle-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* ==========================================================================
   Status Indicators & Tables
   ========================================================================== */
.status-header { border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px; }
.status-indicator { height: 15px; width: 15px; border-radius: 50%; display: inline-block;}
.status-indicator.online { background-color: var(--color-success); box-shadow: 0 0 12px var(--color-success); }
.status-indicator.offline { background-color: var(--color-danger); box-shadow: 0 0 12px var(--color-danger); }
.status-indicator.pending { background-color: var(--text-muted); }
.status-iframe { background-color: var(--bg-card); border: none; width: 100%; }

/* ==========================================================================
   Node Status Grid
   ========================================================================== */
.node-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .node-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .node-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .node-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.node-card {
    padding: 1rem;
    border-left: 4px solid var(--border-color);
}

.node-card.online {
    border-left-color: var(--color-success);
}

.node-card.offline {
    border-left-color: var(--color-danger);
}

.node-card.unknown {
    border-left-color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.online {
    background-color: rgba(34, 197, 94, 0.2);
    color: #16a34a;
}

.status-badge.offline {
    background-color: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.status-badge.unknown {
    background-color: rgba(156, 163, 175, 0.2);
    color: #6b7280;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.25rem;
}

.status-dot.online {
    background-color: #22c55e;
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: #ef4444;
}

.status-dot.unknown {
    background-color: #9ca3af;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.status-summary-item {
    display: flex;
    align-items: center;
}

.status-summary-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-summary-dot.online {
    background-color: var(--color-success);
}

.status-summary-dot.offline {
    background-color: var(--color-danger);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}