/* 기본 스타일 */
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-height: 100vh;
    overflow: hidden;
    transition: background 0.8s ease-in-out;
}

/* 일반 모드 (로그인 화면) */
body:not(.iframe-active) {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* iframe 활성화 시 body 스타일 - 그라데이션 유지 */
body.iframe-active {
    display: block;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* iframe 완전 로드 후에만 배경색 변경 */
body.iframe-active.iframe-loaded {
    background: #000;
}

/* 애니메이션 배경 파티클 */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.3; 
    }
    50% { 
        transform: translateY(-20px) rotate(180deg); 
        opacity: 0.7; 
    }
}

/* 메인 컨테이너 */
.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .container {
        max-width: 90%;
        padding: 40px 30px;
        margin: 0 20px;
    }
}

@media (max-width: 480px) {
    .container {
        max-width: 95%;
        padding: 30px 20px;
        margin: 0 10px;
    }
}

body:not(.iframe-active) .container:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.2);
}

/* 서비스 선택 섹션 */
.service-selection {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.service-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 15px;
    border-radius: 16px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.1);
    min-width: 100px;
    flex: 1;
}

.service-option:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.service-option.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.service-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
}

.service-option.disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}

.service-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    margin-bottom: 8px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.service-option.selected .service-icon {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.service-option.code42 .service-icon {
    background: linear-gradient(135deg, #10b981, #047857);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.service-option.code42.selected .service-icon {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.service-option.music42 .service-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.service-option.music42.selected .service-icon {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.service-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
}

.service-option.disabled .service-title {
    color: #9ca3af;
}

/* 입력 필드 */
.input-field {
    width: 100%;
    padding: 18px 24px;
    margin-bottom: 24px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 1.125rem;
    text-align: center;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: 2px;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* 액션 버튼 */
.action-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 18px 32px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
    opacity: 0.5;
    pointer-events: none;
}

.action-button.enabled {
    opacity: 1;
    pointer-events: auto;
}

.action-button:disabled {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-button::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.5s ease;
}

.action-button.enabled:not(:disabled):hover::before {
    left: 100%;
}

.action-button.enabled:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.action-button.enabled:not(:disabled):active {
    transform: translateY(-1px);
}

/* 관리자 버튼 */
.admin-button {
    position: fixed;
    top: 30px;
    left: 30px;
    background: rgba(59, 130, 246, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 20;
}

body:not(.iframe-active) .admin-button:hover {
    background: rgba(37, 99, 235, 1);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    margin: auto;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .modal {
        padding: 15px;
    }
    
    .modal-content {
        max-width: 90%;
        padding: 30px 25px;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 25px 20px;
    }
    
    .service-selection {
        flex-direction: column;
        gap: 15px;
    }
    
    .service-option {
        min-width: unset;
        width: 100%;
    }
}

/* 닫기 버튼 */
.close-button {
    color: #6b7280;
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-button:hover {
    color: #374151;
    transform: rotate(90deg);
}

/* 메시지 */
.message {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border: 1px solid rgba(14, 165, 233, 0.3);
    backdrop-filter: blur(10px);
}

.message.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.message.success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border-color: rgba(34, 197, 94, 0.3);
    color: #047857;
}

/* 관리자 탭 */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e5e7eb;
}

.admin-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.3s ease;
    flex: 1;
    border-radius: 8px 8px 0 0;
}

.admin-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.admin-tab:hover:not(.active) {
    color: #374151;
    background: rgba(0, 0, 0, 0.05);
}

/* 서비스 관리 카드 */
.service-card {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.service-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.1);
}

.service-card h3 {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-card .input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.service-card .input-field {
    margin-bottom: 0;
    text-align: left;
    letter-spacing: normal;
}

.service-card .url-field {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
}

.disabled-notice {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 12px;
    color: #92400e;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* 숨김 클래스 */
.hidden {
    display: none;
}

/* iframe */
#contentFrame {
    width: 100vw;
    height: 100vh;
    border: none;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    background: transparent;
}

#contentFrame.loaded {
    opacity: 1;
}

body.iframe-active .container,
body.iframe-active .admin-button,
body.iframe-active .particles {
    opacity: 0;
    transition: opacity 0.5s ease-out;
    pointer-events: none;
}

body:not(.iframe-active) .container,
body:not(.iframe-active) .admin-button,
body:not(.iframe-active) .particles {
    opacity: 1;
    transition: opacity 0.5s ease-in;
    pointer-events: auto;
}

/* 돌아가기 버튼 */
.go-back-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 16px 24px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.go-back-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(239, 68, 68, 0.4);
}

/* 제목 스타일 */
.title {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 30px;
}

/* 펄스 애니메이션 */
@keyframes pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); 
    }
}

.pulse {
    animation: pulse 2s infinite;
}