:root {
    /* App Colors */
    --app-bg: #4a6c8c;
    --container-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #475569;

    /* Card Colors */
    --card-blue: #dcf2f9;
    --card-cyan: #e5f6f8;
    --card-gray: #f1f5f9;

    /* Button Colors */
    --btn-blue: #3b76a7;
    --btn-blue-hover: #2c5a82;
    --btn-light: #e2e8f0;
    --btn-light-hover: #cbd5e1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--app-bg);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #10b981;
    color: #fff;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== APP CONTAINER ===== */
.app-container {
    background: var(--container-bg);
    max-width: 1000px;
    width: 100%;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.charter-header {
    padding: 2rem 2rem 1rem;
    text-align: center;
    border-bottom: 2px solid #f1f5f9;
}

.header-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Spread logos: leading, center, trailing */
.logo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: #ffffff;
    padding: 0.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;

    /* Force equal-sized squares */
    flex: 1 1 0;
    aspect-ratio: 1 / 1;
    max-width: 120px;
    max-height: 120px;
}

.logo-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

.logo-link:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.center-logo {
    padding: 5px;
}

.manature-logo {
    padding: 0px;
}

.seekers-logo {
    padding: 10px;
    /* Heavy padding makes it appear visually smaller */
}

.charter-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.charter-subtitle {
    font-size: 1.4rem;
    font-weight: 700;
    color: #334155;
}

/* ===== MAIN BODY ===== */
.charter-body {
    padding: 1.5rem 2rem;
}

.intro-text {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1.5rem;
}

/* ===== VISITOR INFORMATION FORM ===== */
.visitor-form-section {
    display: none;
}

.visitor-form-inline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 800;
    color: #0f172a;
    font-size: 0.95rem;
    text-align: right;
}

.required-asterisk {
    color: #ef4444;
    font-weight: 800;
}

.form-input {
    padding: 0.65rem 1rem;
    padding-left: 45px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-dark);
    background: white;
    transition: all 0.3s ease;
    text-align: right;
    direction: rtl;
}

.form-input:focus {
    outline: none;
    border-color: var(--btn-blue);
    box-shadow: 0 0 0 3px rgba(59, 118, 167, 0.1);
}

.form-input.invalid {
    border-color: #ef4444;
}

.form-input::placeholder {
    color: #cbd5e1;
}

/* ===== SPLIT PHONE INPUT STYLING ===== */
.phone-input-row {
    display: flex;
    gap: 0.75rem;
}

.country-code-input {
    flex: 0 0 auto;
    width: 110px;
    text-align: center;
    cursor: not-allowed;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 700;
}

.country-code-input:disabled {
    opacity: 1;
    border-color: #e2e8f0;
}

.phone-number-input {
    flex: 1;
    text-align: right;
}

.phone-input-wrapper {
    display: none;
}

.error-message {
    font-size: 0.8rem;
    color: #ef4444;
    font-weight: 600;
    text-align: right;
    min-height: 1.1rem;
}

/* ===== SPLIT PHONE INPUT STYLING ===== */
.phone-input-row {
    display: flex;
    gap: 0.35rem;
}

.country-code-input {
    flex: 0 0 auto;
    width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 0.6rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    cursor: default;
    transition: all 0.3s ease;
}

.flag-emoji {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
}

.country-code {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.phone-number-input {
    flex: 1;
    text-align: right;
}

.phone-input-wrapper {
    display: none;
}

.phone-input-wrapper.invalid {
    border-color: #ef4444;
}

.phone-input-row.invalid .country-code-input {
    border-color: #ef4444;
}

.phone-input-row.invalid .phone-number-input {
    border-color: #ef4444;
}

/* ===== 3-COLUMN RULE GRID ===== */
.rules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Rule Card with Two Sections */
.rule-card {
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #ffffff;
    /* White background for text part */
}

.rule-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Colored Top Part / Image Container */
.rule-icon-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* crops to the card corners */
}

.rule-blue {
    background-color: var(--card-blue);
}

.rule-cyan {
    background-color: var(--card-cyan);
}

.rule-gray {
    background-color: var(--card-gray);
}

.rule-icon {
    width: 100%;
    height: auto;
    display: block;
}

/* White Bottom Part */
.rule-content {
    padding: 1rem;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Number in front of title */
.rule-content h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rule-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: #3b76a7;
    display: inline-block;
    background: #f1f5f9;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
}

.rule-content p {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
    font-weight: 600;
}

/* ===== BOTTOM SECTION (BUTTONS + SIGNATURE) ===== */
.bottom-section {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.buttons-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 0;
}

.visitor-form-inline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.form-buttons-divider {
    width: 100%;
    height: 1.5px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
    margin: 0.5rem 0 1rem 0;
}

.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-blue {
    background: var(--btn-blue);
    color: white;
}

.btn-blue:hover:not(:disabled) {
    background: var(--btn-blue-hover);
}

.btn-blue:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-light {
    background: var(--btn-light);
    color: var(--text-dark);
}

.btn-light:hover {
    background: var(--btn-light-hover);
}

.signature-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 1rem;
    background: white;
}

.signature-header {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.date-label {
    font-weight: 800;
    color: #0f172a;
}

.date-value {
    color: #16a34a;
    font-weight: 700;
}

.signature-label {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.signature-wrapper {
    width: 100%;
    border-bottom: 2px solid #0f172a;
}

canvas {
    display: block;
    width: 100%;
    height: 120px;
    touch-action: none;
}

.btn-clear {
    margin-top: 0.5rem;
    background: none;
    border: none;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.btn-clear:hover {
    color: #ef4444;
}

/* ===== FOOTER ===== */
.charter-footer {
    padding: 1rem 2rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    direction: ltr;
    text-align: left;
}

.footer-col {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .rules-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bottom-section {
        flex-direction: column;
    }

    .buttons-column {
        width: 100%;
    }

    .signature-column {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

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

    .logo-row {
        gap: 0.5rem;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .logo-link {
        padding: 0.25rem;
        max-width: 80px;
        max-height: 80px;
    }

    .seekers-logo {
        padding: 15px;
        /* smaller internally on mobile */
    }

    .center-logo {
        padding: 5px;
    }

    .manature-logo {
        padding: 2px;
    }

    .charter-title {
        font-size: 1.2rem;
    }

    .charter-subtitle {
        font-size: 0.95rem;
    }

    .intro-text {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    .rule-content h3 {
        font-size: 1rem;
    }

    .rule-number {
        width: 20px;
        height: 20px;
        line-height: 20px;
        font-size: 0.9rem;
    }

    .rule-content p {
        font-size: 0.85rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.7rem;
    }

    .signature-label,
    .date-label,
    .date-value {
        font-size: 0.85rem;
    }

    .btn-clear {
        font-size: 0.8rem;
    }

    .toast {
        font-size: 0.9rem;
        padding: 0.8rem 1.5rem;
    }
}