/* --- Shared Modal + Panel Primitives --- */

/* Overlay modal shell (dashboard) */


#server-modal,
#points-modal,
#proxy-route-modal,
#rules-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--overlay-dark);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    backdrop-filter: blur(4px);
}

#server-modal.active,
#points-modal.active,
#proxy-route-modal.active,
#rules-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-modal);
    color: var(--text-primary);
    padding: 0;
    width: 90%;
    max-width: 1000px;
    position: relative;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--pixel-shadow);
}

#proxy-route-modal .modal-content {
    width: 90%;
    max-width: 560px;
}

#points-modal .modal-content {
    width: 90%;
    max-width: 560px;
}

#server-modal.active .modal-content,
#points-modal.active .modal-content,
#proxy-route-modal.active .modal-content,
#rules-modal.active .modal-content {
    opacity: 1;
    transform: translateY(0);
}

#rules-modal {
    z-index: 2100;
}

#rules-modal .rules-modal-content {
    width: 90%;
    max-width: 760px;
}

#rules-modal .rules-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    overflow-x: visible;
    max-height: 80vh;
}

.rules-intro {
    margin: 0;
}

.rules-info-box {
    background: var(--bg-modal);
    padding: 0.75rem;
    box-shadow: var(--pixel-shadow), var(--pixel-shadow-inset);
}

#rules-modal .rules-list {
    margin: 0;
    padding-left: 0;
    list-style-position: inside;
    display: grid;
    gap: 0.6rem;
}

#rules-modal .rules-list li::marker {
    font-size: 2em;
    font-weight: 700;
}

.rules-modal-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.rules-modal-error {
    margin-top: 0.6rem;
    color: var(--alert-error);
    font-weight: 700;
}

.rules-modal-error:empty {
    display: none;
}

body.dark-mode .rules-modal-error {
    color: var(--alert-error);
}

.modal-header {
    padding: 0.5rem;
    background-color: var(--header-bg);
    font-size: 1.3em;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header * {
    text-shadow: -1px -1px 0 var(--text-primary), 1px -1px 0 var(--text-primary), -1px 1px 0 var(--text-primary), 1px 1px 0 var(--text-primary);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-white);
}

#landing-pricing-modal .landing-pricing-header.modal-header {
    margin: 0 0 0.8rem 0;
}

.modal-close {
    position: relative;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: none;
    background-image: url('../images/close-button-pressed.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    cursor: pointer;
    font-size: 0;
    color: transparent;
}

.modal-close::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/close-button.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    transition: opacity 0.1s ease, transform 0.1s ease;
}

.modal-close:active::before {
    opacity: 0;
    transform: scale(0.95);
}

.modal-close:active {
    transform: scale(0.95);
}

body.dark-mode .modal-close {
    background-image: url('../images/dark/close-button-pressed.png');
}

body.dark-mode .modal-close::before {
    background-image: url('../images/dark/close-button.png');
}

.modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-modal);
    position: relative;
}

/* Shared panel surface (landing pricing) */
#landing-pricing-modal .landing-pricing-modal-content {
    background: var(--bg-modal);
    box-shadow: var(--pixel-shadow), var(--pixel-shadow-inset);
}
