/**
 * Firewall Dashboard Styles
 */

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1f2937;
    --gray: #6b7280;
    --light-gray: #f3f4f6;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left h1 {
    font-size: 32px;
    color: var(--dark);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--gray);
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.time {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

.user {
    font-size: 13px;
    color: var(--gray);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-logout {
    background: var(--danger);
    color: var(--white);
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-action {
    background: var(--primary);
    color: var(--white);
}

.btn-action:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 5px 10px;
    font-size: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

/* Status Overview */
.status-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.status-card {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.status-card:hover {
    transform: translateY(-5px);
}

.status-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
}

.status-ok .status-icon {
    background: #d1fae5;
    color: var(--success);
}

.status-error .status-icon {
    background: #fee2e2;
    color: var(--danger);
}

.status-warning .status-icon {
    background: #fef3c7;
    color: var(--warning);
}

.status-info-card .status-icon {
    background: #dbeafe;
    color: var(--info);
}

.status-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: var(--dark);
}

.status-info p {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 5px;
}

.status-info small {
    font-size: 12px;
    color: var(--gray);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--white);
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.metric-card.full-width {
    grid-column: 1 / -1;
}

.metric-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.metric-body {
    padding: 25px;
}

/* Rules List */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
    transition: background 0.2s;
}

.rule-item:hover {
    background: #e5e7eb;
}

.rule-number {
    font-weight: bold;
    color: var(--primary);
    min-width: 40px;
}

.rule-text {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Jails List */
.jails-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.jail-item {
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
}

.jail-name {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.jail-stats {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Ports Grid */
.ports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.port-badge {
    padding: 10px;
    background: var(--primary);
    color: var(--white);
    text-align: center;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
}

/* Blocked IPs Panel */
.blocked-ips-panel {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.blocked-ips-panel h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--dark);
}

.blocked-ips-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blocked-ip-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
}

.ip-address {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--danger);
}

.ip-count {
    color: var(--gray);
    font-size: 14px;
}

/* Actions Panel */
.actions-panel {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.actions-panel h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--dark);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Logs Panel */
.logs-panel {
    background: var(--white);
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.logs-header {
    padding: 20px;
    background: var(--dark);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logs-header h3 {
    font-size: 16px;
}

.logs-content {
    padding: 20px;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.log-line {
    padding: 6px 0;
    border-bottom: 1px solid #333;
    word-wrap: break-word;
}

.log-line:last-child {
    border-bottom: none;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--dark);
}

.modal-body {
    padding: 25px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Footer */
.footer {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
}

.footer p {
    font-size: 13px;
    color: var(--gray);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: var(--white);
    margin-top: 20px;
    font-size: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

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

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-header h2 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 5px;
}

.login-header p {
    font-size: 14px;
    color: var(--gray);
}

.login-form {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
}

.login-footer p {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 5px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.empty-state {
    text-align: center;
    color: var(--gray);
    padding: 20px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark);
}
