/* ==========================================================================
   Modal Styles
   ========================================================================== */

.modal-content h2 {
    font-size: 1.9rem;
    margin-bottom: 20px;
}

.close-modal {
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: modalFadeIn 0.4s ease-out forwards;
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

.modal-content {
    background: var(--modal-content-bg);
    color: var(--modal-text-color);
    margin: 20px;
    padding: 40px 45px;
    width: 90%;
    max-width: 750px;
    border-radius: 24px;
    position: relative;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(50px) scale(0.9);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow-y: auto;
    max-height: 90vh;
    border: 1px solid var(--modal-border-color);
}

.modal.visible .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.02) 100%
    );
    border-radius: 24px;
    pointer-events: none;
}

.dark .modal-content::before {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(255, 255, 255, 0.01) 100%
    );
}

.modal-content h2 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--modal-text-color);
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.modal-content p {
    color: var(--modal-secondary-text-color);
    line-height: 1.8;
    margin-bottom: 18px;
    font-size: 1.05rem;
    position: relative;
    z-index: 1;
}

.modal-content a {
    color: var(--modal-accent-color);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: all 0.3s ease;
}

.modal-content a:hover {
    transform: translateY(-1px);
}

.modal-content a:hover::after { 
    width: 100%; 
}

.close-modal {
    position: absolute;
    right: 25px;
    top: 25px;
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
    font-weight: 300;
    cursor: pointer;
    color: var(--modal-secondary-text-color);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
    outline: none;
}

.close-modal:focus {
    outline: none;
}

.close-modal:hover {
    transform: scale(1.1) rotate(90deg);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--modal-text-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.dark .close-modal {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .close-modal:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.modal-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 30px 0;
    position: relative;
    z-index: 1;
}

.modal-images img {
    width: 100%;
    border-radius: 16px;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.1),
        0 5px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    object-fit: cover;
    aspect-ratio: 16/10;
}

.modal-images img:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 10px 25px rgba(0, 0, 0, 0.1);
}

.dark .modal-images img {
    border-color: rgba(255, 255, 255, 0.05);
}

.modal iframe {
    width: 100%;
    height: 450px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin: 30px 0;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.dark .modal iframe {
    border-color: rgba(255, 255, 255, 0.05);
}

#donationModal .iframe-container {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

#kofiframe {
    height: 750px;
}

.modal-content .link-card {
    background: var(--link-card-bg);
    color: var(--link-card-text);
    border: 1px solid var(--link-card-border);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content .link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 16px;
    pointer-events: none;
}

.modal-content .link-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
}

.modal-content .link-card svg {
    stroke: var(--link-card-svg-color);
    transition: all 0.3s ease;
}

.modal-content .link-card:hover svg {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.dark .modal-content .link-card::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.modal-content::-webkit-scrollbar {
    width: 12px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin: 10px 0;
}

.modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-color), var(--modal-accent-color));
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--modal-accent-color), var(--accent-color));
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.dark .modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.modal-content {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) rgba(255, 255, 255, 0.1);
}

.dark .modal-content {
    scrollbar-color: var(--accent-color) rgba(0, 0, 0, 0.2);
}

@keyframes modalContentSlideIn {
    0% {
        transform: translateY(100px) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateY(-10px) scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal.visible .modal-content {
    animation: modalContentSlideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 30px 25px;
        margin: 15px;
        width: calc(100% - 30px);
        border-radius: 20px;
        max-height: 95vh;
    }
    
    .modal-images {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal iframe {
        height: 350px;
        border-radius: 16px;
    }
}