/**
 * MIT License
 * 
 * Copyright (c) 2025 Georgalas Athanasios-Antonios (Thanos), CITEd.gr VLE
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
/* ==========================================================================
   CSS VARIABLES - THEME DEFINITION
   ========================================================================== */
:root {
    /* ===== BASE COLORS ===== */
    --color-white: #ffffff;
    --color-black: #000000;
    
    /* ===== LIGHT THEME (default) ===== */
    /* Backgrounds */
    --bg-body: linear-gradient(135deg, #1a2980 0%, #26d0ce 100%);
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-header: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    --bg-console: #1a252f;
    --bg-console-header: #2c3e50;
    
    /* Text colors */
    --text-primary: #333333;
    --text-secondary: #2c3e50;
    --text-tertiary: #495057;
    --text-muted: #6c757d;
    --text-light: #ffffff;
    --text-console: #ecf0f1;
    
    /* Border colors */
    --border-primary: #dee2e6;
    --border-secondary: #e0e0e0;
    --border-console: #34495e;
    
    /* Shadow colors */
    --shadow-light: rgba(0, 0, 0, 0.04);
    --shadow-medium: rgba(0, 0, 0, 0.08);
    --shadow-dark: rgba(0, 0, 0, 0.1);
    --shadow-console: rgba(0, 0, 0, 0.2);
    
    /* Interface colors */
    --color-wan: #3498db;
    --color-lan: #2ecc71;
    --color-lan2: #9b59b6;
    --color-danger: #e74c3c;
    --color-warning: #f39c12;
    --color-success: #2ecc71;
    --color-info: #00bcd4;
    --color-primary: #3498db;
    
    /* Interface backgrounds */
    --bg-wan: rgba(52, 152, 219, 0.1);
    --bg-lan: rgba(46, 204, 113, 0.1);
    --bg-lan2: rgba(155, 89, 182, 0.1);
    --bg-danger: rgba(231, 76, 60, 0.1);
    --bg-warning: rgba(243, 156, 18, 0.1);
    --bg-success: rgba(46, 204, 113, 0.1);
    --bg-info: rgba(0, 188, 212, 0.1);
    
    /* Grid/Workspace */
    --grid-color: #dee2e6;
    --workspace-bg: #f8f9fa;
    
    /* Buttons */
    --btn-compact-bg: #e9ecef;
    --btn-compact-color: #495057;
    
    /* Form elements */
    --input-bg: #ffffff;
    --input-border: #dee2e6;
    --input-focus: #3498db;
    
    /* Status */
    --status-online-bg: rgba(46, 204, 113, 0.15);
    --status-online-color: #2ecc71;
    --status-danger-bg: rgba(231, 76, 60, 0.15);
    --status-danger-color: #e74c3c;
    
    /* Animation colors */
    --pulse-selected: rgba(243, 156, 18, 0.4);
    --pulse-connect: rgba(46, 204, 113, 0.4);
    --pulse-test: rgba(155, 89, 182, 0.4);
    --pulse-dns: rgba(0, 188, 212, 0.4);
    
    /* Packet colors */
    --packet-trace-bg: linear-gradient(135deg, #9b59b6, #8e44ad);
    --packet-trace-shadow: rgba(155, 89, 182, 0.9);
    --packet-bg: linear-gradient(135deg, #e74c3c, #c0392b);
    --packet-shadow: rgba(231, 76, 60, 0.9);
    
    /* Connection colors */
    --connection-bg: linear-gradient(90deg, #3498db, #2ecc71);
    --connection-shadow: rgba(52, 152, 219, 0.3);
    --valid-connection-bg: linear-gradient(90deg, #2ecc71, #27ae60);
    --invalid-connection-bg: linear-gradient(90deg, #e74c3c, #c0392b);
}

/* ==========================================================================
   DARK THEME VARIABLES
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    :root {
        /* ===== DARK THEME ===== */
        /* Backgrounds */
        --bg-body: #1a1a1a;
        --bg-primary: #2c3e50;
        --bg-secondary: #34495e;
        --bg-tertiary: #4a6572;
        --bg-header: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
        --bg-console: #1a252f;
        --bg-console-header: #2c3e50;
        
        /* Text colors */
        --text-primary: #e0e0e0;
        --text-secondary: #ecf0f1;
        --text-tertiary: #bdc3c7;
        --text-muted: #95a5a6;
        --text-light: #ffffff;
        --text-console: #ecf0f1;
        
        /* Border colors */
        --border-primary: #4a6572;
        --border-secondary: #34495e;
        --border-console: #34495e;
        
        /* Shadow colors */
        --shadow-light: rgba(0, 0, 0, 0.1);
        --shadow-medium: rgba(0, 0, 0, 0.2);
        --shadow-dark: rgba(0, 0, 0, 0.3);
        --shadow-console: rgba(0, 0, 0, 0.2);
        
        /* Interface colors (same for consistency) */
        --color-wan: #3498db;
        --color-lan: #2ecc71;
        --color-lan2: #9b59b6;
        --color-danger: #ff6b6b;
        --color-warning: #f39c12;
        --color-success: #2ecc71;
        --color-info: #00bcd4;
        --color-primary: #3498db;
        
        /* Interface backgrounds (darker) */
        --bg-wan: rgba(52, 152, 219, 0.15);
        --bg-lan: rgba(46, 204, 113, 0.15);
        --bg-lan2: rgba(155, 89, 182, 0.15);
        --bg-danger: rgba(255, 107, 107, 0.15);
        --bg-warning: rgba(243, 156, 18, 0.15);
        --bg-success: rgba(46, 204, 113, 0.15);
        --bg-info: rgba(0, 188, 212, 0.15);
        
        /* Grid/Workspace */
        --grid-color: #34495e;
        --workspace-bg: #1a252f;
        
        /* Buttons */
        --btn-compact-bg: #4a6572;
        --btn-compact-color: #ecf0f1;
        
        /* Form elements */
        --input-bg: #2c3e50;
        --input-border: #4a6572;
        --input-focus: #3498db;
        
        /* Status */
        --status-online-bg: rgba(46, 204, 113, 0.15);
        --status-online-color: #2ecc71;
        --status-danger-bg: rgba(255, 107, 107, 0.15);
        --status-danger-color: #ff6b6b;
        
        /* Animation colors */
        --pulse-selected: rgba(243, 156, 18, 0.6);
        --pulse-connect: rgba(46, 204, 113, 0.6);
        --pulse-test: rgba(155, 89, 182, 0.6);
        --pulse-dns: rgba(0, 188, 212, 0.6);
        
        /* Packet colors (darker variants) */
        --packet-trace-bg: linear-gradient(135deg, #8e44ad, #732d91);
        --packet-trace-shadow: rgba(142, 68, 173, 0.9);
        --packet-bg: linear-gradient(135deg, #ff6b6b, #ee5a52);
        --packet-shadow: rgba(255, 107, 107, 0.9);
        
        /* Connection colors */
        --connection-bg: linear-gradient(90deg, #3498db, #2ecc71);
        --connection-shadow: rgba(52, 152, 219, 0.4);
        --valid-connection-bg: linear-gradient(90deg, #2ecc71, #27ae60);
        --invalid-connection-bg: linear-gradient(90deg, #ff6b6b, #ee5a52);
    }
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==========================================================================
   ANIMATIONS (unchanged but using variables)
   ========================================================================== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulse-selected {
    0%, 100% { box-shadow: 0 0 20px var(--pulse-selected); }
    50% { box-shadow: 0 0 30px var(--pulse-selected); }
}

@keyframes pulse-connect {
    0%, 100% { box-shadow: 0 0 20px var(--pulse-connect); }
    50% { box-shadow: 0 0 30px var(--pulse-connect); }
}

@keyframes pulse-test {
    0%, 100% { box-shadow: 0 0 20px var(--pulse-test); }
    50% { box-shadow: 0 0 30px var(--pulse-test); }
}

@keyframes pulse-dns {
    0%, 100% { box-shadow: 0 0 20px var(--pulse-dns); }
    50% { box-shadow: 0 0 30px var(--pulse-dns); }
}

@keyframes float-packet {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes console-button-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5); }
    50% { box-shadow: 0 4px 20px rgba(231, 76, 60, 0.8), 0 0 0 10px rgba(231, 76, 60, 0.1); }
}

@keyframes terminal-icon-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes trace-pulse {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.3); opacity: 1; }
}

@keyframes path-glow {
    from { opacity: 0.5; box-shadow: 0 0 10px rgba(155, 89, 182, 0.5); }
    to { opacity: 0.9; box-shadow: 0 0 20px rgba(155, 89, 182, 0.8); }
}

@keyframes particle-float {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

/* ==========================================================================
   PACKET & PATH VISUALS
   ========================================================================== */
.packet-trace {
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--packet-trace-bg);
    border-radius: 50%;
    z-index: 100;
    box-shadow: 0 0 15px var(--packet-trace-shadow);
    pointer-events: none;
    animation: trace-pulse 0.8s infinite alternate;
}

.path-visual {
    position: absolute;
    height: 10px;
    background: linear-gradient(90deg, var(--color-lan2), #8e44ad);
    opacity: 0.8;
    transform-origin: 0 0;
    z-index: 3;
    pointer-events: none;
    border-radius: 5px;
    animation: path-glow 1.5s infinite alternate;
}

.packet-animated {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--packet-bg);
    border-radius: 50%;
    z-index: 50;
    box-shadow: 0 0 12px var(--packet-shadow);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: particle-float 1.5s ease-in-out infinite;
}

/* Ειδικά classes για DNS */
.dns-query {
    background: linear-gradient(135deg, #ff9800, #f57c00) !important;
    box-shadow: 0 0 15px #ff9800 !important;
}

.dns-response {
    background: linear-gradient(135deg, #4caf50, #388e3c) !important;
    box-shadow: 0 0 15px #4caf50 !important;
}

.routed-connection {
    background: var(--valid-connection-bg) !important;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4) !important;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.compact-header {
    background: var(--bg-header);
    color: var(--text-light);
    padding: 8px 25px;
    box-shadow: 0 2px 10px var(--shadow-dark);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title h1 {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 600;
    color: var(--text-light);
}

.header-controls {
    display: flex;
    gap: 8px;
}

.app-logo-link {
    display: inline-flex;
    align-items: center;
    margin-right: 12px;
}

.app-logo {
    height: 52px;
    width: auto;
}

.app-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-subtitle-small {
    font-size: 0.8rem;
    opacity: 0.85;
    color: var(--text-light);
}

/* ==========================================================================
   CONTROLS
   ========================================================================== */
.compact-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    align-items: center;
    flex-shrink: 0;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    box-shadow: 0 1px 3px var(--shadow-light);
    flex-shrink: 0;
}

.control-group i {
    color: var(--color-primary);
    font-size: 0.8rem;
}

.control-group span {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    margin-right: 2px;
}

.mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-wan);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--color-primary);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-compact {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--btn-compact-bg);
    color: var(--btn-compact-color);
    font-weight: 500;
}

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

.btn-compact.primary {
    background: var(--color-primary);
    color: var(--text-light);
}

.btn-compact.primary:hover {
    background: #2980b9;
}

.btn-compact.success {
    background: var(--color-success);
    color: var(--text-light);
}

.btn-compact.success:hover {
    background: #27ae60;
}

.btn-compact.warning {
    background: var(--color-warning);
    color: var(--text-light);
}

.btn-compact.warning:hover {
    background: #e67e22;
}

.btn-compact.danger {
    background: var(--color-danger);
    color: var(--text-light);
}

.btn-compact.danger:hover {
    background: #c0392b;
}

.btn-compact.info {
    background: var(--color-info);
    color: var(--text-light);
}

.btn-compact.info:hover {
    background: #0097a7;
}

/* Ειδικά εφέ για κονσόλα button */
.header-controls .btn-compact:nth-child(2) {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: var(--text-light) !important;
    border: 2px solid var(--text-light) !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5) !important;
    animation: console-button-pulse 2s infinite !important;
    position: relative;
    overflow: hidden;
}

.header-controls .btn-compact:nth-child(2):hover {
    background: linear-gradient(135deg, #c0392b, #a93226) !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.7) !important;
}

.header-controls .btn-compact:nth-child(2) i {
    animation: terminal-icon-blink 1.5s infinite;
}

.header-controls .btn-compact:nth-child(2)::before {
    content: ">";
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-warning);
    color: var(--text-light);
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-pulse 1.5s infinite;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #2980b9);
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #27ae60);
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(46, 204, 113, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, var(--color-warning), #e67e22);
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(243, 156, 18, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #c0392b);
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(231, 76, 60, 0.2);
}

.btn-info {
    background: linear-gradient(135deg, var(--color-info), #0097a7);
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(0, 188, 212, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

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

.save-load-buttons {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.btn-save, .btn-load {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: var(--text-light);
}

.btn-load {
    background: linear-gradient(135deg, #2196F3, #1565C0);
    color: var(--text-light);
}

.btn-save:hover, .btn-load:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-save::before {
    content: "💾";
}

.btn-load::before {
    content: "📂";
}

.delete-connection {
    background: linear-gradient(135deg, var(--color-danger), #c0392b);
    color: var(--text-light);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
}

.delete-connection:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.main-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sidebar-left {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-right {
    width: 350px;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-primary);
    display: none;
    flex-shrink: 0;
}

.sidebar-right.active {
    display: flex;
    flex-direction: column;
}

.workspace-container {
    flex: 1;
    position: relative;
    background: var(--workspace-bg);
    overflow: auto;
    min-height: 0;
}

.workspace {
    width: 100%;
    height: 100%;
    position: relative;
    min-height: 100%;
    background: 
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px) 0 0 / 30px 30px,
        linear-gradient(var(--grid-color) 1px, transparent 1px) 0 0 / 30px 30px;
    overflow: auto;
}

/* ==========================================================================
   DEVICE PANEL (ENHANCED)
   ========================================================================== */
.device-panel {
    background: var(--bg-primary);
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border-radius: 12px 0 0 0;
    box-shadow: inset 0 0 10px var(--shadow-light);
}

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

.device-panel-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-panel {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 5px;
}

.close-panel:hover {
    color: var(--color-danger);
}

/* Config panel styling */
.config-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    border: 1px solid var(--border-primary);
}

.config-panel h4 {
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
    font-size: 1.2rem;
}

/* ==========================================================================
   DEVICE LIST
   ========================================================================== */
.compact-device-list {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.device-category {
    margin-bottom: 20px;
}

.category-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.device-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    user-select: none;
}

.device-card:hover {
    border-color: var(--color-primary);
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px var(--shadow-medium);
}

.device-card i {
    font-size: 1.5rem;
    margin-bottom: 5px;
    display: block;
}

.device-card-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* ==========================================================================
   DEVICES IN WORKSPACE
   ========================================================================== */
.device {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 3px 6px var(--shadow-light);
    transition: all 0.3s;
    z-index: 10;
    user-select: none;
    overflow: hidden;
}

.device:hover {
    transform: scale(1.05);
    z-index: 20;
}

.device i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.device-name {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3px;
}

.device-ip {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.9);
    text-align: center;
    background: rgba(0,0,0,0.2);
    padding: 2px 6px;
    border-radius: 3px;
}

.device.selected {
    border: 3px solid var(--color-warning);
    box-shadow: 0 0 20px var(--pulse-selected);
    animation: pulse-selected 2s infinite;
}

.device.connect-mode {
    border: 3px solid var(--color-success);
    box-shadow: 0 0 20px var(--pulse-connect);
    animation: pulse-connect 2s infinite;
}

.device.test-mode {
    border: 3px solid var(--color-lan2);
    box-shadow: 0 0 20px var(--pulse-test);
    animation: pulse-test 2s infinite;
}

.device.dns-source-mode {
    border: 3px solid var(--color-info);
    box-shadow: 0 0 20px var(--pulse-dns);
    animation: pulse-dns 2s infinite;
}

/* ==========================================================================
   CONNECTIONS & PACKETS
   ========================================================================== */
.connection {
    position: absolute;
    height: 5px;
    background: var(--connection-bg);
    transform-origin: 0 0;
    z-index: 1;
    pointer-events: none;
    border-radius: 3px;
    box-shadow: 0 2px 5px var(--connection-shadow);
    transition: all 0.3s ease;
}

.connection::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -3px;
    width: 12px;
    height: 12px;
    background: var(--packet-bg);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--packet-shadow);
    animation: pulse-dot 2s infinite;
}

.packet {
    position: absolute;
    width: 15px;
    height: 15px;
    background: var(--packet-bg);
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 15px var(--packet-shadow);
    pointer-events: none;
    animation: float-packet 3s ease-in-out infinite;
}

.valid-connection {
    background: var(--valid-connection-bg) !important;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.4) !important;
}

.invalid-connection {
    background: var(--invalid-connection-bg) !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4) !important;
}

.connection-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--color-primary);
}

.connection-info {
    flex: 1;
}

.connection-name {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.connection-type {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   CONSOLE
   ========================================================================== */
.resizable-console {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: var(--bg-console);
    border-top: 2px solid var(--color-primary);
    z-index: 1000;
    box-shadow: 0 -2px 10px var(--shadow-console);
    display: flex;
    flex-direction: column;
    min-height: 100px;
    max-height: 80vh;
}

.console-header {
    background: var(--bg-console-header);
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: ns-resize;
    user-select: none;
    border-bottom: 1px solid var(--border-console);
    flex-shrink: 0;
}

.console-title {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-controls {
    display: flex;
    gap: 5px;
}

.console-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-console);
    min-height: 0;
}

.console-resize-handle {
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    z-index: 1001;
}

/* ==========================================================================
   STATS & STATUS
   ========================================================================== */
.quick-stats {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 4px 10px;
    background: var(--bg-wan);
    border-radius: 12px;
    color: var(--color-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse 2s infinite;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-online {
    background: var(--status-online-bg);
    color: var(--status-online-color);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger-color);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer-clean {
    padding: 8px 20px;
    border-top: 1px solid var(--border-secondary);
    background: var(--bg-secondary);
    font-size: 1.0rem;
    flex-shrink: 0;
    z-index: 1;
}

.footer-line {
    height: 3px;
    background: linear-gradient(90deg, #1a2980, #26d0ce);
    margin-bottom: 8px;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-name {
    color: var(--text-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.footer-right {
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

.footer-left {
    white-space: nowrap;
}

.footer-icons {
    display: flex;
    gap: 10px;
}

.icon {
    color: var(--text-tertiary);
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ==========================================================================
   INTERFACE STYLING για το generateRouterConfigHTML
   ========================================================================== */

/* Titles για τα interface sections */
.interface-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid;
    color: var(--text-secondary);
}

.interface-section-title.wan {
    color: var(--color-wan);
    border-color: var(--color-wan);
}

.interface-section-title.lan {
    color: var(--color-lan);
    border-color: var(--color-lan);
}

.interface-section-title.lan2 {
    color: var(--color-lan2);
    border-color: var(--color-lan2);
}

/* Interface items */
.interface-item {
    margin: 8px 0;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.interface-item.wan {
    border-color: var(--color-wan);
    background: var(--bg-wan);
}

.interface-item.lan {
    border-color: var(--color-lan);
    background: var(--bg-lan);
}

.interface-item.lan2 {
    border-color: var(--color-lan2);
    background: var(--bg-lan2);
}

.interface-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px var(--shadow-medium);
}

.interface-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.interface-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* No connections message */
.no-connections-message {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.no-connections-message i {
    font-size: 2rem;
    opacity: 0.5;
    margin-bottom: 10px;
    display: block;
}

/* Delete connection button */
.interface-item .delete-connection {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
}
/* Interface item details styling */
.interface-item-details {
    flex: 1;
}

.interface-device-name {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.interface-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'Fira Code', 'Courier New', monospace;
}

/* Interface buttons */
.interface-item .btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-left: 10px;
    flex-shrink: 0;
}
/* ==========================================================================
   INTERFACE SETTINGS SECTIONS για τις ρυθμίσεις router
   ========================================================================== */

.interface-settings-section {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 4px var(--shadow-light);
    transition: all 0.2s ease;
}

.interface-settings-section:hover {
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.interface-settings-section.wan {
    border-left: 4px solid var(--color-wan);
}

.interface-settings-section.lan {
    border-left: 4px solid var(--color-lan);
}

.interface-settings-section.lan2 {
    border-left: 4px solid var(--color-lan2);
}

/* Interface settings titles */
.interface-settings-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid;
    color: var(--text-secondary);
}

.interface-settings-title.wan {
    color: var(--color-wan);
    border-color: rgba(52, 152, 219, 0.3);
}

.interface-settings-title.lan {
    color: var(--color-lan);
    border-color: rgba(46, 204, 113, 0.3);
}

.interface-settings-title.lan2 {
    color: var(--color-lan2);
    border-color: rgba(155, 89, 182, 0.3);
}

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Update button */
.update-all-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-size: 1rem;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.hidden-file-input {
    display: none;
}

.no-ip {
    color: #95a5a6;
    font-style: italic;
    font-size: 0.9rem;
}

.active {
    background: linear-gradient(135deg, #8e44ad, #732d91) !important;
    color: var(--text-light) !important;
}

.log-message {
    padding: 4px 0;
    border-bottom: 1px solid var(--border-console);
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-message.info { color: var(--color-primary); }
.log-message.success { color: var(--color-success); }
.log-message.warning { color: var(--color-warning); }
.log-message.error { color: var(--color-danger); }

.info { color: var(--color-primary); }
.success { color: var(--color-success); }
.warning { color: var(--color-warning); }
.danger { color: var(--color-danger); }
.primary { color: var(--color-primary); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media only screen and (max-width: 600px) {
    .compact-header {
        padding: 12px 15px !important;
    }
    
    .header-top {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .header-title {
        width: 100%;
        justify-content: space-between;
    }
    
    .app-logo {
        height: 40px !important;
    }
    
    .header-title h1 {
        font-size: 1.1rem !important;
    }
    
    .app-subtitle-small {
        display: none;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
        gap: 5px;
        margin-top: 5px;
    }
    
    .btn-compact {
        padding: 10px 12px !important;
        min-height: 44px;
        flex: 1;
        justify-content: center;
    }
    
    .compact-controls {
        padding: 12px 10px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 8px;
        scrollbar-width: none;
    }
    
    .compact-controls::-webkit-scrollbar {
        display: none;
    }
    
    .control-group {
        flex: 0 0 auto !important;
        padding: 10px 12px !important;
        min-width: fit-content;
    }
    
    .main-layout {
        flex-direction: column !important;
    }
    
    .sidebar-left {
        width: 100% !important;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }
    
    .compact-device-list {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        padding: 10px;
        gap: 12px;
        height: 120px;
    }
    
    .device-category {
        flex: 0 0 auto;
        width: 180px;
        margin-bottom: 0;
    }
    
    .device-grid {
        grid-template-columns: 1fr !important;
    }
    
    .device-card {
        padding: 15px 10px !important;
        min-width: 80px;
        min-height: 90px;
    }
    
    .sidebar-right {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 2000;
    }
    
    .footer-row {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
}

/* ==========================================================================
   FONT AWESOME COMPATIBILITY
   ========================================================================== */
.fas {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

/* Επιπλέον κλάσεις που χρειάζονται για icons */
.fa-terminal:before { content: "\f120"; }
.fa-cog:before { content: "\f013"; }
.fa-desktop:before { content: "\f108"; }
.fa-server:before { content: "\f233"; }
.fa-wifi:before { content: "\f1eb"; }
.fa-cloud:before { content: "\f0c2"; }
.fa-shield-alt:before { content: "\f3ed"; }
.fa-satellite-dish:before { content: "\f7c0"; }
.fa-network-wired:before { content: "\f6ff"; }
.fa-route:before { content: "\f4d7"; }
.fa-link:before { content: "\f0c1"; }
.fa-unlink:before { content: "\f127"; }
.fa-play:before { content: "\f04b"; }
.fa-play-circle:before { content: "\f144"; }
.fa-trash:before { content: "\f1f8"; }
.fa-trash-alt:before { content: "\f2ed"; }
.fa-save:before { content: "\f0c7"; }
.fa-folder-open:before { content: "\f07c"; }
.fa-print:before { content: "\f02f"; }
.fa-search:before { content: "\f002"; }
.fa-question-circle:before { content: "\f059"; }
.fa-bug:before { content: "\f188"; }
.fa-vial:before { content: "\f492"; }
.fa-times:before { content: "\f00d"; }
.fa-circle:before { content: "\f111"; }
.fa-exchange-alt:before { content: "\f362"; }
.fa-hand-pointer:before { content: "\f25a"; }
.fa-mouse-pointer:before { content: "\f245"; }
.fa-tools:before { content: "\f7d9"; }
/* ==========================================================================
   DNS RECORDS STYLING για το generateDNSConfigHTML
   ========================================================================== */

.dns-records-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-primary);
}

.dns-records-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dns-records-title i {
    color: var(--color-info);
}

.dns-records-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
}

/* DNS Record Item */
.dns-record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-primary);
    transition: all 0.2s ease;
}

.dns-record-item:last-child {
    border-bottom: none;
}

.dns-record-item:hover {
    background: var(--bg-secondary);
}

.dns-record-item.local {
    border-left: 3px solid var(--color-success);
}

.dns-record-item.external {
    border-left: 3px solid var(--color-warning);
}

.dns-record-item.custom {
    border-left: 3px solid var(--color-info);
}

.dns-record-content {
    flex: 1;
}

.dns-record-domain {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.dns-record-ip {
    font-family: 'Fira Code', 'Courier New', monospace;
    color: var(--color-wan);
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Delete button */
.dns-record-delete-btn {
    background: var(--bg-danger);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 10px;
    flex-shrink: 0;
}

.dns-record-delete-btn:hover {
    background: var(--color-danger);
    color: var(--text-light);
    transform: scale(1.1);
}

.dns-record-delete-btn i {
    font-size: 0.8rem;
}

/* DNS Empty State */
.dns-empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.dns-empty-state i {
    font-size: 2rem;
    opacity: 0.5;
    margin-bottom: 10px;
    display: block;
}

.dns-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* DNS Add Record Form */
.dns-add-record-form {
    margin-top: 15px;
}

.dns-add-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

.dns-add-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dns-add-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dns-add-btn {
    height: 42px;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* DNS Update Button */
.dns-update-btn {
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    font-size: 1rem;
}

/* ==========================================================================
   DARK THEME για DNS
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .dns-record-domain {
        color: var(--text-secondary);
    }
    
    .dns-record-ip {
        color: #4fc3f7;
    }
    
    .dns-record-item.local {
        border-left-color: var(--color-success);
        background: rgba(46, 204, 113, 0.05);
    }
    
    .dns-record-item.external {
        border-left-color: var(--color-warning);
        background: rgba(243, 156, 18, 0.05);
    }
    
    .dns-record-item.custom {
        border-left-color: var(--color-info);
        background: rgba(0, 188, 212, 0.05);
    }
    
    .dns-record-item:hover {
        background: var(--bg-tertiary);
    }
    
    .dns-record-delete-btn:hover {
        background: #ff6b6b;
        border-color: #ff6b6b;
    }
}
/* ==========================================================================
   DEVICE INFO STYLING
   ========================================================================== */

/* Text color classes */
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-light { color: var(--text-light) !important; }

/* Info grid styling */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.info-item {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--color-primary);
}

.info-item strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

/* Device info values */
.device-name-value,
.device-type-value,
.connection-count-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-online {
    background: var(--status-online-bg);
    color: var(--status-online-color);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-offline {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-primary);
}
.duplicate-ip-warning {
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0% { box-shadow: 0 0 5px #ffcc00; }
    50% { box-shadow: 0 0 15px #ffcc00; }
    100% { box-shadow: 0 0 5px #ffcc00; }
}
