* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    color: #ffffff;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
}

.refresh-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #1a1a1a;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid #333333;
}

.refresh-btn:hover {
    background: #2a2a2a;
    border-color: #555555;
    transform: rotate(180deg);
}

.refresh-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.proxy-section {
    background: #111111;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #222222;
    flex: 1;
    max-width: 500px;
}

.proxy-header h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.proxy-header h3::before {
    content: '';
    font-size: 14px;
}

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

.proxy-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #333333;
    border-radius: 6px;
    font-size: 14px;
    background: #1a1a1a;
    color: #ffffff;
    transition: all 0.2s ease;
}

.proxy-input.state-configured {
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.1);
}

.proxy-input.state-empty {
    border-color: #333333;
}

.proxy-input.state-error {
    border-color: #ff4444;
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.1);
}

.proxy-input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.1);
}

.proxy-input::placeholder {
    color: #666666;
}

.current-proxy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #0a0a0a;
    border-radius: 6px;
    border: 1px solid #333333;
}

.proxy-label {
    color: #cccccc;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.proxy-value {
    font-size: 13px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.proxy-value.configured {
    color: #00ff88;
}

.proxy-value.not-configured {
    color: #ffaa00;
    font-style: italic;
}

.proxy-value.error {
    color: #ff4444;
    font-style: italic;
}

.server-list {
    display: flex;
    flex-direction: column;
}

.server-item {
    background: #111111;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #222222;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.server-item:hover {
    background: #1a1a1a;
    border-color: #333333;
}

.server-item.enabled {
    border-left: 3px solid #00ff88;
}

.server-item.disabled {
    border-left: 3px solid #ff4444;
    opacity: 0.7;
}

.nato-code {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 60px;
    text-align: center;
    background: #1a1a1a;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #333333;
}

.server-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
}

.order-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-btn {
    width: 28px;
    height: 24px;
    border: 1px solid #333333;
    background: #1a1a1a;
    color: #cccccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.order-btn:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: #555555;
    color: #ffffff;
}

.order-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.server-info {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.enabled {
    background: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.status-indicator.disabled {
    background: #ff4444;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.3);
}

.server-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #333333;
    border-radius: 6px;
    font-size: 14px;
    background: #1a1a1a;
    color: #ffffff;
    transition: all 0.2s ease;
}

.server-input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.1);
}

.server-input:disabled {
    background: #0a0a0a;
    color: #666666;
    cursor: not-allowed;
}

.server-input::placeholder {
    color: #666666;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #333333;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: #00ff88;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: #111111;
    border-radius: 8px;
    border: 1px solid #222222;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #333333;
    border-top: 2px solid #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .controls {
        flex-direction: column;
        gap: 16px;
    }
    
    .proxy-section {
        max-width: none;
    }
    
    .proxy-controls {
        flex-direction: column;
    }
    
    .server-item {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .nato-code {
        min-width: auto;
        text-align: left;
    }
    
    .server-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .order-controls {
        flex-direction: row;
        justify-content: center;
    }
    
    .server-info {
        order: -1;
    }
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid #222222;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: #cccccc;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #ffffff;
    background: #1a1a1a;
}

.tab-btn.active {
    color: #00ff88;
    border-bottom-color: #00ff88;
    background: #0a0a0a;
}

.tab-content {
    display: block;
}

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

.sites-header h3 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.add-site-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #00ff88;
    color: #000000;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-site-btn:hover {
    background: #00cc6a;
    transform: translateY(-1px);
}

.sites-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.site-item {
    background: #111111;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #222222;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-item:hover {
    background: #1a1a1a;
    border-color: #333333;
}

.site-info {
    flex: 1;
}

.site-hostname {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.site-details {
    font-size: 14px;
    color: #cccccc;
    display: flex;
    gap: 16px;
}

.site-actions {
    display: flex;
    gap: 8px;
}

.site-btn {
    padding: 6px 12px;
    border: 1px solid #333333;
    background: #1a1a1a;
    color: #cccccc;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.site-btn:hover {
    background: #2a2a2a;
    border-color: #555555;
    color: #ffffff;
}

.site-btn.danger:hover {
    background: #ff4444;
    border-color: #ff4444;
    color: #ffffff;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #111111;
    border-radius: 8px;
    border: 1px solid #222222;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #222222;
}

.modal-header h3 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #cccccc;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #2a2a2a;
    color: #ffffff;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #222222;
}

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

.form-group label {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #333333;
    border-radius: 6px;
    font-size: 14px;
    background: #1a1a1a;
    color: #ffffff;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn-primary {
    padding: 10px 20px;
    background: #00ff88;
    color: #000000;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #00cc6a;
}

.btn-secondary {
    padding: 10px 20px;
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #333333;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #3a3a3a;
    border-color: #555555;
}

@media (max-width: 480px) {
    .server-item {
        padding: 10px;
    }
    
    .nato-code {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .server-input {
        font-size: 13px;
        padding: 6px 10px;
    }
}

.no-sites {
    text-align: center;
    padding: 2rem;
    color: #888;
    font-style: italic;
}

.modal-body h4 {
    color: #ffffff;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body h4:first-child {
    margin-top: 0;
}

.meta-section {
    margin: 1.5rem 0;
}

.meta-controls {
    margin-bottom: 1rem;
}

.meta-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    background: #1a1a1a;
}

.meta-item {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
}

.meta-item:last-child {
    margin-bottom: 0;
}

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

.meta-item-path {
    font-weight: 600;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    background: #333;
    padding: 4px 8px;
    border-radius: 3px;
}

.meta-item-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
}

.meta-item-remove:hover {
    background: #c82333;
}

.meta-item-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.meta-item-fields .form-group {
    margin-bottom: 10px;
}

.meta-item-fields .form-group:last-child {
    margin-bottom: 0;
}

.meta-item-fields label {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 4px;
}

.meta-item-fields input,
.meta-item-fields textarea {
    font-size: 13px;
    padding: 6px 8px;
}

.meta-item-fields textarea {
    resize: vertical;
    min-height: 60px;
}

@media (max-width: 768px) {
    .meta-item-fields {
        grid-template-columns: 1fr;
    }
}
