/**
 * Conditional Redirects Admin Styles
 * Shadcn-inspired minimal, clean design
 *
 * @package Switchboard
 * @since 1.0.0
 */

/* ===== MAIN CONTAINER ===== */
.conditional-redirects-wrap {
    max-width: 1400px;
    margin: 20px 0;
}

/* ===== HEADER ===== */
.cr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.cr-header .header-left h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.switchboard-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(var(--primary-500-rgb), 0.2);
}

.subtitle {
    margin: 4px 0 0 0;
    font-size: 14px;
    padding-left: 0px;
    color: #64748b;
    font-weight: 400;
}

.header-right .button-hero {
    background: var(--primary-500);
    color: white;
    border: 1px solid var(--primary-500);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    height: auto;
    box-shadow: 0 2px 4px rgba(var(--primary-500-rgb), 0.2);
}

.header-right .button-hero:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--primary-500-rgb), 0.3);
}

.header-right .button-hero .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

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

.stat-card {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--primary-200);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.06);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-900);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* ===== EMPTY STATE ===== */
.cr-empty-state {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.cr-empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0 0 12px 0;
}

.cr-empty-state p {
    font-size: 15px;
    color: #64748b;
    margin: 0 0 32px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.empty-state-btn {
    background: var(--primary-500) !important;
    border-color: var(--primary-500) !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 14px 32px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    height: auto !important;
    box-shadow: 0 2px 4px rgba(var(--primary-500-rgb), 0.2) !important;
}

.empty-state-btn:hover {
    background: var(--primary-600) !important;
    border-color: var(--primary-600) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--primary-500-rgb), 0.3) !important;
}

.empty-state-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.empty-state-examples {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--primary-50);
}

.empty-state-examples h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.example-item {
    background: #f8fafc;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.example-item .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: var(--primary-500);
}

.example-item strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-900);
}

.example-item span:last-child {
    font-size: 12px;
    color: #64748b;
}

/* ===== LIST CONTAINER ===== */
.cr-list-container {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
}

.cr-list-header {
    padding: 24px;
    border-bottom: 1px solid var(--primary-50);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cr-list-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0;
}

.list-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    padding: 8px 16px;
    border: 1px solid var(--primary-100);
    border-radius: 6px;
    font-size: 14px;
    width: 280px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(var(--primary-500-rgb), 0.1);
}

/* ===== TABLE ===== */
.cr-table-wrapper {
    overflow-x: auto;
}

.cr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cr-table thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--primary-100);
}

.cr-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cr-table td {
    padding: 16px;
    border-bottom: 1px solid var(--primary-50);
    color: #0f172a;
    vertical-align: middle;
}

.cr-table tbody tr {
    transition: background-color 0.2s;
}

.cr-table tbody tr:hover {
    background: #f8fafc;
}

.cr-table tbody tr:last-child td {
    border-bottom: none;
}

.cr-table tbody tr.inactive {
    opacity: 0.5;
}

/* Column widths */
.col-active {
    width: 80px;
    text-align: center;
}

.col-rule-name {
    width: 180px;
}

.col-source {
    width: 140px;
}

.col-conditions {
    width: auto;
    min-width: 200px;
}

.col-redirect {
    width: 200px;
}

.col-type {
    width: 80px;
    text-align: center;
}

.col-hits {
    width: 100px;
    text-align: center;
}

.col-actions {
    width: 160px;
    text-align: right;
}

/* ===== TABLE CELLS ===== */
.priority-badge {
    color: #64748b;
    font-size: 11px;
}

.text-muted {
    color: var(--gray-400);
    font-style: italic;
}

.condition-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
}

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

.condition-badge.param {
    background: #fef3c7;
    color: #92400e;
}

.condition-badge.referrer {
    background: var(--primary-100);
    color: #3730a3;
}

.condition-badge.login {
    background: #dcfce7;
    color: #166534;
}

.action-type {
    font-size: 14px;
    margin-right: 4px;
}

.redirect-url {
    font-size: 12px;
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 3px;
    word-break: break-all;
}

.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.type-badge.type-301 {
    background: #dcfce7;
    color: #166534;
}

.type-badge.type-302 {
    background: #fef3c7;
    color: #92400e;
}

.hit-count {
    font-weight: 700;
    color: var(--primary-500);
    font-size: 15px;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: var(--primary-500);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-slider:hover {
    background-color: #94a3b8;
}

input:checked + .toggle-slider:hover {
    background-color: var(--primary-600);
}

/* ===== BUTTONS ===== */
.button-small {
    padding: 6px 12px !important;
    height: auto !important;
    font-size: 12px !important;
    border-radius: 4px !important;
}

.button-secondary {
    background: white !important;
    border: 1px solid var(--primary-100) !important;
    color: #64748b !important;
}

.button-secondary:hover {
    background: #f8fafc !important;
    border-color: var(--primary-200) !important;
    color: var(--primary-900) !important;
}

.button-link-delete {
    background: transparent !important;
    border: 1px solid #fecaca !important;
    color: #dc2626 !important;
}

.button-link-delete:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}

/* ===== HELP PANEL ===== */
.cr-help-panel {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    margin-top: 24px;
}

.help-toggle {
    width: 100%;
    padding: 16px 24px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-900);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.help-toggle:hover {
    background: #f8fafc;
}

.help-toggle .dashicons {
    color: var(--primary-500);
}

.help-content {
    padding: 0 24px 24px 24px;
}

.help-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0 0 20px 0;
}

.help-section {
    margin-bottom: 24px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0 0 12px 0;
}

.help-section p {
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.help-section ul {
    margin: 0;
    padding-left: 20px;
    color: #64748b;
    line-height: 1.8;
}

.help-section ul li {
    margin-bottom: 8px;
}

.help-section ul li:last-child {
    margin-bottom: 0;
}

.help-section ul li strong {
    color: var(--primary-900);
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .cr-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .header-right {
        width: 100%;
        display: flex;
        gap: 12px;
    }
}

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

    .example-grid {
        grid-template-columns: 1fr;
    }

    .cr-table {
        font-size: 12px;
    }

    .cr-table th,
    .cr-table td {
        padding: 12px 8px;
    }

    .search-input {
        width: 100%;
    }

    .col-actions {
        min-width: 140px;
    }
}

/* ===== EDIT PAGE STYLES ===== */
.cr-edit-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.edit-card {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.edit-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--primary-50);
}

.edit-card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-900);
    margin: 0 0 4px 0;
}

.edit-card-header p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.edit-card-body {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

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

.form-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary-900);
    margin-bottom: 8px;
}

.form-label.required::after {
    content: " *";
    color: #dc2626;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--primary-100);
    border-radius: 6px;
    font-size: 14px;
    color: #0f172a;
    background: white;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(var(--primary-500-rgb), 0.1);
}

.form-input[readonly] {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.form-help {
    font-size: 12px;
    color: #64748b;
    margin: 6px 0 0 0;
    line-height: 1.5;
}

.form-help code {
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: var(--primary-900);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #0f172a;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Condition Groups */
.condition-group {
    background: #f8fafc;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.condition-group:last-child {
    margin-bottom: 0;
}

.condition-header {
    margin-bottom: 0;
}

.condition-header .checkbox-label {
    font-weight: 600;
}

.condition-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-900);
}

.condition-body {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--primary-100);
}

.edit-actions {
    background: white;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.edit-actions-left,
.edit-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button-delete {
    color: #dc2626 !important;
    border-color: #fecaca !important;
}

.button-delete:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}

.button-delete .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.button-primary {
    background: var(--primary-500) !important;
    border-color: var(--primary-500) !important;
    color: white !important;
}

.button-primary:hover {
    background: var(--primary-600) !important;
    border-color: var(--primary-600) !important;
}

.button-primary .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: fadeIn 0.3s ease;
}
