/**
 * TokenPocket 멀티 지갑 인증 시스템 CSS
 * 프리미엄 디자인 및 모바일 최적화
 */

/* ========================================
   프리미엄 모달 기본 스타일
   ======================================== */
.premium-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.9));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999999;
    animation: modalFadeIn 0.3s ease-out;
}

.premium-modal.show {
    display: flex;
}

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

.premium-modal-content {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.4s ease-out;
}

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

.premium-modal-header {
    padding: 24px 24px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.premium-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.premium-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-modal-close:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff4444;
    transform: rotate(90deg);
}

.premium-modal-body {
    padding: 0 24px 20px;
}

.premium-modal-footer {
    padding: 20px 24px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ========================================
   추천인 검색 컨테이너
   ======================================== */
.referral-search-container {
    position: relative;
    margin: 20px 0;
}

.referral-search-container input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.referral-search-container input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
    background: #ffffff;
}

.referral-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 4px;
}

.referral-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.referral-suggestion:last-child {
    border-bottom: none;
}

.referral-suggestion:hover {
    background: linear-gradient(90deg, rgba(25, 118, 210, 0.1), rgba(66, 165, 245, 0.1));
    color: #1976d2;
    transform: translateX(4px);
}

.selected-referral {
    margin: 16px 0;
    padding: 16px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(129, 199, 132, 0.1));
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 12px;
    color: #2e7d32;
    font-weight: 600;
}

/* ========================================
   프리미엄 버튼
   ======================================== */
.premium-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 120px;
    text-align: center;
}

.premium-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.premium-btn:hover::before {
    left: 100%;
}

.premium-btn.primary {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: white;
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.3);
}

.premium-btn.primary:hover {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4);
    transform: translateY(-2px);
}

.premium-btn.primary:disabled {
    background: linear-gradient(135deg, #bdbdbd, #e0e0e0);
    color: #757575;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.premium-btn.secondary {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    color: #424242;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.premium-btn.secondary:hover {
    background: linear-gradient(135deg, #eeeeee, #d5d5d5);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* ========================================
   지갑 선택기 스타일
   ======================================== */
.wallet-selector-container {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 300px;
    max-width: 400px;
}

.wallet-selection-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wallet-selection-panel label {
    font-weight: 600;
    color: #424242;
    font-size: 14px;
}

.wallet-selector {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.wallet-selector:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.refresh-btn, .test-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #43a047, #4caf50);
    transform: translateY(-1px);
}

.test-btn {
    background: linear-gradient(135deg, #ff9800, #ffb74d);
    color: white;
}

.test-btn:hover {
    background: linear-gradient(135deg, #f57c00, #ff9800);
    transform: translateY(-1px);
}

/* ========================================
   지갑 카드 스타일
   ======================================== */
.wallet-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.wallet-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wallet-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.wallet-card:hover::before {
    transform: scaleX(1);
}

.wallet-card:hover {
    border-color: #1976d2;
    box-shadow: 0 8px 24px rgba(25, 118, 210, 0.15);
    transform: translateY(-2px);
}

.wallet-card.active {
    border-color: #4caf50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(129, 199, 132, 0.05));
}

.wallet-card.active::before {
    background: linear-gradient(90deg, #4caf50, #66bb6a);
    transform: scaleX(1);
}

.wallet-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.wallet-icon {
    font-size: 24px;
}

.wallet-name {
    font-weight: 700;
    font-size: 16px;
    color: #424242;
}

.active-badge {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    margin-left: auto;
}

.wallet-address {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
    margin-bottom: 16px;
    word-break: break-all;
}

.wallet-actions {
    display: flex;
    gap: 8px;
}

.select-wallet-btn, .test-wallet-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-wallet-btn {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: white;
}

.select-wallet-btn:hover {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    transform: translateY(-1px);
}

.test-wallet-btn {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    color: #424242;
}

.test-wallet-btn:hover {
    background: linear-gradient(135deg, #eeeeee, #d5d5d5);
    transform: translateY(-1px);
}

/* ========================================
   모바일 최적화
   ======================================== */
@media (max-width: 768px) {
    .premium-modal-content {
        width: 95%;
        margin: 10px;
        border-radius: 16px;
    }
    
    .premium-modal-header {
        padding: 20px 20px 0;
    }
    
    .premium-modal-header h3 {
        font-size: 20px;
    }
    
    .premium-modal-body {
        padding: 0 20px 16px;
    }
    
    .premium-modal-footer {
        padding: 16px 20px 20px;
        flex-direction: column;
    }
    
    .premium-btn {
        width: 100%;
        padding: 16px;
        font-size: 16px;
    }
    
    .wallet-selector-container {
        position: static;
        margin: 20px;
        min-width: auto;
        max-width: none;
    }
    
    .wallet-cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .referral-search-container input {
        font-size: 16px; /* iOS zoom 방지 */
    }
}

@media (max-width: 480px) {
    .premium-modal-content {
        width: 98%;
        margin: 5px;
        border-radius: 12px;
    }
    
    .premium-modal-header {
        padding: 16px 16px 0;
    }
    
    .premium-modal-header h3 {
        font-size: 18px;
    }
    
    .premium-modal-body {
        padding: 0 16px 12px;
    }
    
    .premium-modal-footer {
        padding: 12px 16px 16px;
    }
    
    .wallet-selector-container {
        margin: 10px;
        padding: 16px;
        border-radius: 12px;
    }
}

/* ========================================
   다크 모드 지원
   ======================================== */
@media (prefers-color-scheme: dark) {
    .premium-modal {
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.95));
    }
    
    .premium-modal-content {
        background: linear-gradient(135deg, #2c2c2c, #1e1e1e);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
    
    .premium-modal-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .premium-modal-footer {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .referral-search-container input {
        background: linear-gradient(135deg, #3c3c3c, #2c2c2c);
        border: 2px solid #555;
        color: #ffffff;
    }
    
    .referral-search-container input:focus {
        border-color: #42a5f5;
        background: #3c3c3c;
    }
    
    .referral-suggestions {
        background: #2c2c2c;
        border: 1px solid #555;
    }
    
    .referral-suggestion:hover {
        background: linear-gradient(90deg, rgba(66, 165, 245, 0.2), rgba(25, 118, 210, 0.2));
        color: #42a5f5;
    }
    
    .wallet-selector-container {
        background: linear-gradient(135deg, rgba(44, 44, 44, 0.95), rgba(30, 30, 30, 0.95));
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }
    
    .wallet-card {
        background: linear-gradient(135deg, #2c2c2c, #1e1e1e);
        border: 2px solid #555;
        color: #ffffff;
    }
    
    .wallet-card:hover {
        border-color: #42a5f5;
    }
}

/* ========================================
   애니메이션 및 효과
   ======================================== */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(25, 118, 210, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(25, 118, 210, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(25, 118, 210, 0);
    }
}

.premium-btn.primary:focus {
    animation: pulse 1.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-shake {
    animation: shake 0.5s ease-in-out;
}

/* ========================================
   접근성 개선
   ======================================== */
.premium-btn:focus,
.wallet-selector:focus,
.referral-search-container input:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.premium-modal-close:focus {
    outline: 2px solid #ff4444;
    outline-offset: 2px;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .premium-modal-content {
        border: 3px solid #000000;
    }
    
    .premium-btn.primary {
        background: #0000ff;
        border: 2px solid #000000;
    }
    
    .premium-btn.secondary {
        background: #ffffff;
        border: 2px solid #000000;
        color: #000000;
    }
}

/* 움직임 감소 설정 지원 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
