/* Common CSS Variables and Shared Styles */
:root {
    --primary-purple: #4A006E;
    --accent-gold: #C39F45;
    --accent-gold-hover: #b38f3d;
}

/* Common Body Styles */
body {
    color: var(--primary-purple);
    background-color: #FFFFFF;
}

/* Common Button Styles */
.btn-custom {
    background-color: var(--accent-gold);
    color: #FFFFFF;
    border: none;
    transition: background-color 0.3s ease;
}

.btn-custom:hover {
    background-color: var(--accent-gold-hover);
    color: #FFFFFF;
}

/* Common Border and Text Utilities */
.border-custom {
    border-color: var(--accent-gold) !important;
}

.text-custom {
    color: var(--primary-purple);
}

/* Common Modal Styles */
.popup-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: #1a1a1a;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    text-align: left;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    cursor: pointer;
}

/* Common Speech Balloon Styles */
#balloon-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.speech-balloon {
    position: absolute;
    background: var(--accent-gold);
    color: #FFFFFF;
    padding: 10px 15px;
    border-radius: 15px;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    font-size: 1em;
    pointer-events: auto;
    max-width: 200px;
}

.speech-balloon::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: var(--accent-gold);
    border-bottom: 0;
    margin-left: -10px;
    margin-bottom: -10px;
}

/* Skip Navigation Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--accent-gold);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
    font-weight: bold;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
    outline: 3px solid white;
    outline-offset: 2px;
}

/* Enhanced Focus Styles - High Contrast */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--accent-gold);
    outline-offset: 2px;
    box-shadow: 0 0 0 1px white, 0 0 0 4px var(--accent-gold);
}

.star-icon:focus {
    outline: 3px solid var(--accent-gold);
    outline-offset: 2px;
    border-radius: 4px;
    box-shadow: 0 0 0 1px white, 0 0 0 4px var(--accent-gold);
}

/* Focus trap elements */
.focus-trap-start,
.focus-trap-end {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Loading overlay focus management */
#loading-overlay:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn:focus,
    input:focus,
    select:focus,
    textarea:focus,
    .star-icon:focus {
        outline: 4px solid;
        outline-offset: 2px;
        box-shadow: none;
    }
}

/* Accessibility: Screen reader only content */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Common Responsive Rules */
@media (max-width: 768px) {
    #balloon-container {
        display: none;
    }
}