/* Cloudflare Management Panel - Styles */

/* ==================== Variables ==================== */
:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c7c;

    --accent-primary: #f48120;
    --accent-secondary: #ff9f43;
    --accent-blue: #4da3ff;
    --accent-green: #26de81;
    --accent-red: #fc5c65;
    --accent-purple: #a55eea;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);

    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    --transition: all 0.3s ease;
}

/* ==================== Reset ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ==================== Login Page ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.login-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: 0 25px 50px var(--shadow-color);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-header .logo svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.login-form input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(244, 129, 32, 0.1);
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Login Background Shapes */
.login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.bg-shape-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -200px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.bg-shape-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-blue);
    bottom: -150px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

.bg-shape-3 {
    width: 200px;
    height: 200px;
    background: var(--accent-purple);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-30px) rotate(5deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.2;
    }
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(244, 129, 32, 0.3);
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #e84554;
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.btn-icon:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn .spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==================== Panel Layout ==================== */
.panel-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-header .logo svg {
    width: 22px;
    height: 22px;
    color: white;
}

.sidebar-header span {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(244, 129, 32, 0.2), rgba(255, 159, 67, 0.1));
    color: var(--accent-primary);
    border: 1px solid rgba(244, 129, 32, 0.3);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-logout svg {
    width: 18px;
    height: 18px;
}

.btn-logout:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(252, 92, 101, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.zone-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zone-selector label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.select-zone {
    min-width: 250px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.select-zone:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.select-zone option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    flex: 1;
}

.tab-content.active {
    display: block;
}

/* ==================== Dashboard ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px var(--shadow-color);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

.stat-icon-blue {
    background: linear-gradient(135deg, #4da3ff, #5271ff);
}

.stat-icon-orange {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.stat-icon-green {
    background: linear-gradient(135deg, #26de81, #20bf6b);
}

.stat-icon-purple {
    background: linear-gradient(135deg, #a55eea, #8854d0);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Zone Info Card */
.zone-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.zone-info-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.zone-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.zone-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zone-detail .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zone-detail .value {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.zone-detail .value.mono {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-active,
.badge-success {
    background: rgba(38, 222, 129, 0.2);
    color: var(--accent-green);
}

.badge-pending {
    background: rgba(255, 159, 67, 0.2);
    color: var(--accent-secondary);
}

.badge-error {
    background: rgba(252, 92, 101, 0.2);
    color: var(--accent-red);
}

/* ==================== Tables ==================== */
.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.tab-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.rules-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.rules-table {
    width: 100%;
}

.rules-table th {
    text-align: left;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.rules-table td {
    padding: 16px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.rules-table tr:last-child td {
    border-bottom: none;
}

.rules-table tbody tr:hover {
    background: var(--bg-glass);
}

.rules-table .empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.rules-table code {
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg-glass);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--accent-blue);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* Expression Examples */
.expression-examples {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
}

.expression-examples h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.expression-examples ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.expression-examples li {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.expression-examples code {
    font-family: monospace;
    background: var(--bg-glass);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--accent-blue);
    margin-right: 4px;
}

/* ==================== Settings ==================== */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 700px;
}

.settings-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.settings-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.settings-form .form-group {
    margin-bottom: 24px;
}

.settings-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-form input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.settings-form input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.settings-form small {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.api-instructions {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.api-instructions h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.api-instructions ol {
    padding-left: 20px;
}

.api-instructions li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    line-height: 1.6;
}

.api-instructions ul {
    margin-top: 8px;
    padding-left: 20px;
}

.api-instructions a {
    color: var(--accent-blue);
}

.api-instructions a:hover {
    text-decoration: underline;
}

/* ==================== Messages ==================== */
.error-message {
    background: rgba(252, 92, 101, 0.1);
    border: 1px solid rgba(252, 92, 101, 0.3);
    color: var(--accent-red);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.success-message {
    background: rgba(38, 222, 129, 0.1);
    border: 1px solid rgba(38, 222, 129, 0.3);
    color: var(--accent-green);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ==================== Modal ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.modal-body textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-body select option {
    background: var(--bg-secondary);
}

.modal-body small {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-body .form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 40px var(--shadow-color);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-success {
    border-left: 4px solid var(--accent-green);
}

.toast.toast-error {
    border-left: 4px solid var(--accent-red);
}

.toast.toast-info {
    border-left: 4px solid var(--accent-blue);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: var(--accent-green);
}

.toast-error .toast-icon {
    color: var(--accent-red);
}

.toast-info .toast-icon {
    color: var(--accent-blue);
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

/* ==================== Loading ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== Responsive ==================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        padding: 0 20px;
    }

    .zone-selector label {
        display: none;
    }

    .select-zone {
        min-width: 180px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .form-actions {
        flex-direction: column;
    }

    .expression-examples ul {
        flex-direction: column;
    }

    .rules-table {
        display: block;
        overflow-x: auto;
    }
}

/* ==================== WAF Rule Builder ==================== */
.rule-builder {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 20px;
    margin-top: 16px;
}

.rule-builder h4 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}


.condition-row {
    margin-bottom: 12px;
}

.condition-join {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-blue);
    text-transform: uppercase;
    padding: 8px 0;
    margin-left: 8px;
}

.condition-fields {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.condition-fields select,
.condition-fields input {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.condition-fields select:focus,
.condition-fields input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.condition-fields select:disabled,
.condition-fields input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.condition-fields select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.condition-fields select optgroup {
    color: var(--text-muted);
    font-weight: 600;
}

.field-select {
    min-width: 160px;
}

.operator-select {
    min-width: 140px;
}

.value-input {
    min-width: 180px;
    flex: 1;
}

.condition-buttons {
    display: flex;
    gap: 4px;
    margin-left: 4px;
}

.btn-join {
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-join:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(77, 163, 255, 0.1);
}

.btn-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-remove:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(252, 92, 101, 0.1);
}

.expression-toggle {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 8px;
}

.expression-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.expression-preview {
    margin-top: 12px;
}

.expression-preview label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.expression-preview textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--accent-blue);
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

.expression-preview textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* Modal size for rule builder */
.modal-content {
    max-width: 700px;
}

@media (max-width: 768px) {
    .condition-fields {
        flex-direction: column;
        align-items: stretch;
    }

    .field-select,
    .operator-select,
    .value-input {
        min-width: 100%;
    }

    .condition-buttons {
        justify-content: flex-end;
        margin-top: 8px;
        margin-left: 0;
    }
}

/* Disabled rule styling */
.disabled-rule {
    opacity: 0.5;
}

.disabled-rule td {
    text-decoration: line-through;
}

/* Button variants */
.btn-warning {
    background: #f5a623;
    color: white;
}

.btn-warning:hover {
    background: #e09517;
}