* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: #4a6ee0;
}

.logo h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 700;
}

.tagline {
    color: #7f8c8d;
    font-size: 1.2rem;
    font-weight: 300;
}

.app-container {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
}

.config-panel, .result-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    backdrop-filter: blur(10px);
}

.panel-title {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f3f4;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title i {
    color: #4a6ee0;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
    display: flex;
    align-items: center;
    gap: 8px;
}

label i {
    color: #4a6ee0;
}

select, input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

select:focus, input:focus {
    outline: none;
    border-color: #4a6ee0;
    box-shadow: 0 0 0 3px rgba(74, 110, 224, 0.1);
}

.wan-interface {
    margin-bottom: 15px;
}

.input-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.input-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

.btn {
    background: #4a6ee0;
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #4a6ee0, #6a49e2);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.btn-full {
    width: 100%;
}

/* Result Panel - Ensure proper containment */
.result-panel {
    display: flex;
    flex-direction: column;
}

/* WHITE Terminal Box Styling - FIXED WRAPPING */
.terminal-box {
    background-color: #FFFFFF;
    color: #000000;
    font-family: 'Courier New', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    padding: 20px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    overflow: auto;
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex: 1;
}

.terminal-box pre {
    margin: 0;
    white-space: pre-wrap;       /* CHANGED: Allow wrapping */
    word-wrap: break-word;       /* ADDED: Break long words */
    word-break: break-all;       /* ADDED: Break at any character if needed */
    overflow-wrap: break-word;   /* ADDED: Modern property for word breaking */
    font-size: 14px;
    line-height: 1.5;
    display: block;
    width: 100%;
    overflow: visible;
}

/* Custom scrollbar for white terminal */
.terminal-box::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.terminal-box::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

.terminal-box::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 6px;
    border: 3px solid #f8f9fa;
}

.terminal-box::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.terminal-box::-webkit-scrollbar-corner {
    background: #f8f9fa;
}

/* For Firefox */
.terminal-box {
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 #f8f9fa;
}

.result-actions {
    display: flex;
    gap: 15px;
}

.info-box {
    background: #e8f4fd;
    border: 1px solid #b6e0fe;
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
}

.info-box h3 {
    color: #2c5aa0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box ol {
    padding-left: 20px;
}

.info-box li {
    margin-bottom: 8px;
    color: #2c5aa0;
}

footer {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    color: #7f8c8d;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #2ecc71;
    color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.error {
    background: #e74c3c;
}

.notification.success {
    background: #2ecc71;
}

/* Animation for form elements */
.form-group {
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MOBILE FIXES - Proper wrapping */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .config-panel, .result-panel {
        padding: 20px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .terminal-box {
        min-height: 300px;
        max-height: 400px;
        padding: 15px;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .terminal-box pre {
        font-size: 12px;
        /* FIXED: Proper wrapping on mobile */
        white-space: pre-wrap;
        word-wrap: break-word;
        word-break: break-all;
        overflow-wrap: break-word;
        overflow-x: auto;
        display: block;
        width: 100%;
    }
    
    /* Smaller scrollbars on mobile */
    .terminal-box::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
}