/* ========== КНОПКА И МОДАЛКА "ПРАВИЛА РАБОТЫ" (только index.php) ========== */

/* --- Кнопка --- */
.rules-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration) var(--ease, ease);
}

.rules-btn:hover {
    color: var(--brand);
    border-color: var(--brand);
    box-shadow: var(--shadow-sm);
    transform: none;
}

.rules-btn span {
    font-size: 14px;
}

/* --- Overlay --- */
.rules-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    inset: 0;
    background: rgba(0,0,0,.45);
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: rulesFadeIn .2s ease;
}

.rules-modal.active {
    display: flex;
}

@keyframes rulesFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Content card --- */
.rules-modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 580px;
    max-height: 80vh;
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-md, 0 10px 15px -3px rgba(0,0,0,.08));
    display: flex;
    flex-direction: column;
    animation: rulesSlideUp .25s var(--ease, ease);
    overflow: hidden;
}

@keyframes rulesSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Header --- */
.rules-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.rules-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.rules-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 8px);
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration) var(--ease, ease);
    line-height: 1;
}

.rules-close:hover {
    background: var(--brand-light, rgba(0,149,246,.08));
    color: var(--brand);
}

/* --- Body --- */
.rules-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.rules-text h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin: 20px 0 8px 0;
}

.rules-text h4:first-child {
    margin-top: 0;
}

.rules-text p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.65;
    margin: 6px 0;
    padding-left: 18px;
    position: relative;
}

.rules-text p:before {
    content: "\2022";
    color: var(--brand);
    font-weight: bold;
    position: absolute;
    left: 4px;
}

.rules-text a {
    color: var(--brand);
    text-decoration: none;
}

.rules-text a:hover {
    text-decoration: underline;
}

.rules-text b {
    color: var(--text-primary);
}

.rules-note {
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm, 8px);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-align: center;
}

.rules-note:before {
    display: none !important;
}

/* --- Footer --- */
.rules-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    flex-shrink: 0;
}

.rules-ok-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 36px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--brand, #0095f6);
    border: none;
    border-radius: var(--radius, 12px);
    cursor: pointer;
    transition: all var(--duration) var(--ease, ease);
    min-width: 160px;
}

.rules-ok-btn:hover {
    background: var(--brand-hover, #0078cc);
    box-shadow: var(--shadow-sm);
    transform: none;
}

/* --- Dark theme --- */
body.dark .rules-modal {
    background: rgba(0,0,0,.6);
}

body.dark .rules-modal-content {
    background: #1e1e2e;
    border: 1px solid #2a2a3e;
}

body.dark .rules-modal-header {
    border-bottom-color: #2a2a3e;
}

body.dark .rules-modal-header h3 {
    color: #e8e8ed;
}

body.dark .rules-close {
    color: #9ca0ab;
}

body.dark .rules-close:hover {
    background: rgba(0,149,246,.12);
    color: var(--brand);
}

body.dark .rules-text h4 {
    color: #e8e8ed;
}

body.dark .rules-text p {
    color: #9ca0ab;
}

body.dark .rules-text a {
    color: #5bb8ff;
}

body.dark .rules-text b {
    color: #e8e8ed;
}

body.dark .rules-note {
    background: #14141f;
    color: #9ca0ab;
}

body.dark .rules-modal-footer {
    border-top-color: #2a2a3e;
}

body.dark .rules-btn {
    background: #1e1e2e;
    border-color: #2a2a3e;
    color: #9ca0ab;
}

body.dark .rules-btn:hover {
    color: var(--brand);
    border-color: var(--brand);
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .rules-modal {
        padding: 12px;
        align-items: flex-end;
    }

    .rules-modal-content {
        max-height: 85vh;
        border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
        max-width: 100%;
    }

    .rules-modal-header {
        padding: 16px 20px;
    }

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

    .rules-modal-body {
        padding: 16px 20px;
    }

    .rules-text h4 {
        font-size: 14px;
    }

    .rules-text p {
        font-size: 13px;
    }

    .rules-modal-footer {
        padding: 14px 20px;
    }

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

    .rules-btn span {
        font-size: 13px;
    }
}