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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === HEADER === */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 { font-size: 24px; }

/* === NAVIGATION === */
.nav {
    display: flex;
    gap: 10px;
    padding: 15px 20px 0;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 20px;
    background: #e0e0e0;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s;
}

.nav-link:hover { background: #d0d0d0; }
.nav-link.active { background: #1a1a2e; color: white; }
.nav-link.active:hover { background: #1a1a2e; }

/* === CONTAINER === */
.container {
    flex: 1;
    padding: 20px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* === CARDS === */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 { color: #1a1a2e; margin-bottom: 15px; font-size: 18px; }
.card h3 { color: #1a1a2e; margin: 15px 0 10px; font-size: 16px; }

/* === TABLES === */
.table-responsive { overflow-x: auto; }

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

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th { background: #f8f9fa; font-weight: 600; color: #333; }
tr:hover { background: #f8f9fa; }

/* === BADGES & STATUS === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-primary { background: #cce5ff; color: #004085; }

.ip-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e9ecef;
    color: #495057;
    margin: 2px;
}

.proto-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.proto-tcp { background: #007bff; color: white; }
.proto-udp { background: #28a745; color: white; }

.code-display {
    font-family: monospace;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}

/* === BUTTONS === */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
    text-align: center;
}

.btn-primary { background: #007bff; color: white; }
.btn-primary:hover { background: #0056b3; }

.btn-success { background: #28a745; color: white; }
.btn-success:hover { background: #218838; }

.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }

.btn-warning { background: #ffc107; color: #212529; }
.btn-warning:hover { background: #e0a800; }

.btn-outline {
    background: rgba(255,255,255,0.2);
    color: white;
}
.btn-outline:hover { background: rgba(255,255,255,0.3); }

.btn-sm { padding: 4px 8px; font-size: 12px; }

/* Icon buttons with white background */
.btn-icon.btn-warning { background: #fff; border: 1px solid #ffc107; }
.btn-icon.btn-warning:hover { background: #fff3cd; }

.btn-icon.btn-danger { background: #fff; border: 1px solid #dc3545; }
.btn-icon.btn-danger:hover { background: #f8d7da; }

.btn-icon.btn-success { background: #fff; border: 1px solid #28a745; }
.btn-icon.btn-success:hover { background: #d4edda; }

/* === FORMS === */
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

/* Form-group with only buttons (no label) - add spacing to match label height */
.form-inline .form-group button {
    margin-top: 24px;
}

.form-control {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
}

.form-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.form-inline .form-control { width: auto; }

/* === ALERTS === */
.alert {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* === EMPTY STATE === */
.empty { text-align: center; padding: 40px; color: #666; }

/* === STATS === */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card h3 { color: #666; font-size: 13px; margin-bottom: 5px; }
.stat-card .value { font-size: 24px; font-weight: bold; color: #1a1a2e; }

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active { display: flex; }

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
}

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

.modal-header h3 { color: #1a1a2e; font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* === FIREWALL RULES === */
.firewall-rules {
    background: #1a1a2e;
    color: #00ff00;
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    overflow-x: auto;
}

/* === FOOTER === */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 12px;
    border-top: 1px solid #e0e0e0;
    margin-top: auto;
}

/* === LOGIN PAGE === */
.login-page {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-page .header,
.login-page .nav,
.login-page .footer { display: none; }

.login-page .container {
    max-width: 400px;
    width: 100%;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    text-align: center;
}

.login-card .logo-emoji { font-size: 48px; margin-bottom: 20px; }
.login-card h1 { color: #1a1a2e; margin-bottom: 10px; font-size: 24px; }
.login-card p { color: #666; margin-bottom: 30px; }
.login-card .form-group { margin-bottom: 20px; text-align: left; }
.login-card label { display: block; margin-bottom: 8px; font-weight: 600; }
.login-card .form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}
.login-card .form-control:focus { outline: none; border-color: #4a90d9; }
.login-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

/* === PORTAL PAGE === */
.portal-page {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.portal-page .header,
.portal-page .nav,
.portal-page .footer { display: none; }

.portal-page .container {
    max-width: 450px;
    width: 100%;
}

.portal-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    position: relative;
}

.portal-card .lang-switch {
    position: absolute;
    top: 15px;
    right: 15px;
}

.portal-card .lang-switch a {
    color: #4a90d9;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 10px;
    border: 1px solid #4a90d9;
    border-radius: 5px;
    transition: all 0.3s;
}

.portal-card .lang-switch a:hover {
    background: #4a90d9;
    color: white;
}

.portal-card .logo-container { text-align: center; margin-bottom: 20px; }
.portal-card .logo-container img { max-width: 180px; max-height: 80px; object-fit: contain; }
.portal-card .logo-emoji { font-size: 48px; display: block; margin-bottom: 20px; text-align: center; }
.portal-card h1 { color: #1a1a2e; margin-bottom: 10px; font-size: 24px; text-align: center; }
.portal-card p { color: #666; margin-bottom: 30px; line-height: 1.6; text-align: center; }
.portal-card .form-group { margin-bottom: 20px; }
.portal-card label { display: block; color: #333; font-weight: 600; margin-bottom: 8px; }
.portal-card .form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}
.portal-card .form-control:focus { outline: none; border-color: #4a90d9; }
.portal-card .btn-primary {
    width: 100%;
    padding: 14px;
    background: #4a90d9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.portal-card .btn-primary:hover { background: #357abd; }
.portal-card .message {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}
.portal-card .message.success { background: #d4edda; color: #155724; }
.portal-card .message.error { background: #f8d7da; color: #721c24; }
.portal-card .info-box {
    background: #f0f4f8;
    border-radius: 8px;
    padding: 16px;
    margin-top: 24px;
    font-size: 14px;
    color: #555;
}
.portal-card .info-box h3 { color: #1a1a2e; margin-bottom: 8px; font-size: 14px; }
.portal-card .footer {
    text-align: center;
    margin-top: 24px;
    color: #999;
    font-size: 12px;
}
.portal-card .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}
.portal-card .status-badge.status-ok { background: #d4edda; color: #155724; }
.portal-card .status-badge.status-down { background: #f8d7da; color: #721c24; }

/* === UTILITIES === */
.text-center { text-align: center; }
.text-muted { color: #666; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.actions { display: flex; gap: 5px; flex-wrap: wrap; align-items: flex-start; }
