/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0f1218;
    --bg-card: #181c24;
    --bg-card-hover: #202530;
    --primary: #3a7afe;
    --primary-glow: rgba(58, 122, 254, 0.5);
    --text-main: #f3f6fa;
    --text-muted: #aeb4c6;
    --border-color: #2a3040;
    --success: #00d26a;
}

html,
body {
    background: var(--bg-dark) !important;
    color: var(--text-main);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    background: #13161c;
    border-right: 1px solid var(--border-color);
    padding: 32px 0 0 0;
    height: 100vh;
    z-index: 10;
}

.sidebar-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-left: 32px;
    margin-bottom: 40px;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #aeb4c6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    color: var(--text-muted);
    padding: 14px 32px;
    font-size: 1.05rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar ul li:hover,
.sidebar ul li.active {
    background: rgba(58, 122, 254, 0.08);
    color: #fff;
    border-left: 3px solid var(--primary);
    text-shadow: 0 0 10px rgba(58, 122, 254, 0.4);
}

.sidebar ul li button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--primary-glow);
}

.sidebar ul li button:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 50px 60px;
    background: radial-gradient(circle at top right, #1a1f2e 0%, var(--bg-dark) 60%);
    min-height: 100vh;
}

h2 {
    color: #fff;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 30px;
    letter-spacing: -1px;
}

/* Stats Card */
.card {
    background: linear-gradient(145deg, var(--bg-card), #13161c);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 32px !important;
    display: flex;
    gap: 40px;
    margin-bottom: 40px !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
}

.card div {
    display: flex;
    flex-direction: column;
}

.card strong {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.card div:last-child {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

/* Rules Table / Cards */
#rulesTableContainer {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 16px;
}

.table th,
.table td {
    padding: 12px 24px;
    vertical-align: middle;
}

/* Name Column (Left Aligned) */
.table th:nth-child(1),
.table td:nth-child(1) {
    width: 40%;
    text-align: left;
}

/* Status Column (Center Aligned) */
.table th:nth-child(2),
.table td:nth-child(2) {
    width: 30%;
    text-align: center;
}

/* Actions Column (Center Aligned) */
.table th:nth-child(3),
.table td:nth-child(3) {
    width: 30%;
    text-align: center;
}

.table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding: 0 24px 12px 24px;
    border: none;
}

/* Rule Row Cards */
.table td {
    background: var(--bg-card);
    border: none;
    padding: 20px 24px;
    color: var(--text-main);
    font-size: 1.05rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* First and Last Cells for Border Radius */
.table tr.rule-row td:first-child {
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    border-left: 1px solid var(--border-color);
}

.table tr.rule-row td:last-child {
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    border-right: 1px solid var(--border-color);
}

/* Hover Effect: Lift + Glow */
.table tr.rule-row:hover td {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    border-color: rgba(58, 122, 254, 0.3);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.table tr.rule-row:hover td:first-child {
    border-left-color: rgba(58, 122, 254, 0.3);
    box-shadow: -4px 10px 25px -5px rgba(58, 122, 254, 0.1), inset 2px 0 0 var(--primary);
}

.table tr.rule-row:hover td:last-child {
    border-right-color: rgba(58, 122, 254, 0.3);
}

/* Buttons */
.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.action-btn.edit-btn:hover {
    background: rgba(58, 122, 254, 0.2);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.action-btn.delete-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    border-color: #ff3b30;
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.4);
}

/* Toggle Switch - Neon Style */
.toggle-switch {
    width: 50px;
    height: 28px;
    position: relative;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    /* Take it out of flow */
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a3040;
    border-radius: 34px;
    border: 1px solid #3a3f50;
    transition: .4s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: #aeb4c6;
    border-radius: 50%;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: rgba(58, 122, 254, 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(22px);
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

/* Modal */
.modal {
    backdrop-filter: blur(8px);
    background: rgba(15, 18, 24, 0.8);
}

.modal-content {
    background: #1e2430;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6);
}

/* Base override for edit forms */
.rule-editor input[type="text"],
.rule-editor textarea,
.rule-editor select {
    background: #13161c !important;
    border: 1px solid var(--border-color) !important;
    color: #fff !important;
    border-radius: 8px !important;
    padding: 12px !important;
    transition: all 0.2s;
}

.rule-editor input[type="text"]:focus,
.rule-editor textarea:focus,
.rule-editor select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(58, 122, 254, 0.2) !important;
    outline: none;
}