/* ===========================================
   Modal Components
   =========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none !important;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* 모달 z-index 조정 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex !important;
    opacity: 1;
}

.modal-content {
    background: var(--color-card-dark);
    border: 1px solid var(--color-border-dark);
    border-radius: 1rem;
    padding: 0;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

.modal.show .modal-content,
.modal[style*="display: flex"] .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border-dark);
}

.modal-title {
    color: var(--color-text-dark);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: var(--color-text-muted-dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-dark);
}

.modal-body {
    padding: 1.5rem;
}

/* ===========================================
   Social Share Modal
   =========================================== */
.social-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.social-share-modal.modal-show {
    display: flex !important;
    opacity: 1;
}

.social-share-modal-content {
    background: var(--color-card-dark);
    border: 1px solid var(--color-border-dark);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

.social-share-modal.modal-show .social-share-modal-content {
    transform: scale(1);
    opacity: 1;
}

.social-share-modal-content h3 {
    color: var(--color-text-dark);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.share-preview {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-dark);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.share-preview h4 {
    color: var(--color-text-dark);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.share-preview-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 0.75rem;
}

.share-preview-text {
    color: var(--color-text-muted-dark);
    line-height: 1.6;
    font-size: 0.9rem;
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border-dark);
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.share-platforms h4 {
    color: var(--color-text-dark);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.platform-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-dark);
    border-radius: 1rem;
    color: var(--color-text-dark);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    /* 모바일 터치 최적화 - 최소 44px 높이 확보 */
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.platform-button:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 127, 245, 0.3);
}

.platform-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.platform-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.platform-name {
    font-size: 0.75rem;
    text-align: center;
}

.close-button {
    width: 2.75rem; /* 44px 확보 */
    height: 2.75rem; /* 44px 확보 */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-muted-dark);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    /* 모바일 터치 최적화 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.close-button:hover {
    background: var(--color-card-hover);
    color: var(--color-text-dark);
}

.close-button svg {
    width: 1rem;
    height: 1rem;
}

/* ===========================================
   Toast Messages
   =========================================== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* 메시지 아래 요소와 상호작용 가능하도록 */
    width: 90%;
    max-width: 350px;
}

.toast-message {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    animation: toastSlideIn 0.3s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: auto; /* 메시지 자체는 클릭 가능하도록 */
}

.toast-message.hide {
    animation: toastSlideOut 0.3s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-message.info {
    background-color: #3498db;
}

.toast-message.success {
    background-color: #2ecc71;
}

.toast-message.error {
    background-color: #e74c3c;
}

.toast-message.warning {
    background-color: #f39c12;
}

@keyframes toastSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

/* ===========================================
   Loading Overlay
   =========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: loadingFadeIn 0.5s ease-out;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 90%;
    padding: 2rem;
    animation: loadingContentFadeIn 0.7s ease-out 0.2s both;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: loadingSpin 1.5s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: #ff6b35;
    animation-duration: 1.2s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top-color: #4ecdc4;
    animation-duration: 0.8s;
}

.loading-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

.loading-message {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 2rem;
    line-height: 1.5;
    animation: messageFadeIn 1s ease-out 0.5s both;
}

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s steps(3, end) infinite;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
    animation: progressBarFadeIn 1s ease-out 1s both;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ff6b35, #4ecdc4);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes loadingSpin {
    to { transform: rotate(360deg); }
}

@keyframes loadingFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.9);
    }
    to { 
        opacity: 1; 
        transform: scale(1);
    }
}

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

@keyframes loadingDots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

@keyframes titleGlow {
    from { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.3); }
    to { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.6); }
}

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

@keyframes progressBarFadeIn {
    from { opacity: 0; transform: scaleX(0); }
    to { opacity: 1; transform: scaleX(1); }
}

@keyframes progressGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

