/* e:\llaragon\www\home\012googletext\local\011\style.css */

:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --light-bg: #f8f9fa;
    --dark-text: #202124;
    --light-text: #5f6368;
    --border-color: #dadce0;
    --hover-color: #e8f0fe;
    --disabled-bg: #f1f3f4;
    --disabled-text: #80868b;
    
    /* 애니메이션 관련 변수 */
    --animation-fast: 0.15s;
    --animation-medium: 0.3s;
    --animation-slow: 0.6s;
    --easing: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', 'Noto Sans KR', sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

/* --- 새로운 레이아웃 스타일 --- */
.main-layout {
    display: flex;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

.sidebar-iframe {
    flex: 0 0 250px;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    transition: all var(--animation-medium) var(--easing);
}

.sidebar-iframe:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.content-wrapper {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding-right: 5px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    padding: 24px;
    transition: box-shadow var(--animation-medium) var(--easing);
}

.container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
}

/* --- 기본 요소 스타일 --- */
h1 {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 500;
    animation: fadeInUp 0.6s var(--easing);
}

.app-description {
    text-align: center;
    color: var(--light-text);
    margin-bottom: 20px;
    font-size: 14px;
    animation: fadeInUp 0.6s var(--easing) 0.1s both;
}

.main-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.6s var(--easing) 0.2s both;
}

.main-header .youtube-link {
    color: var(--light-text);
    margin-bottom: 20px;
    font-size: 14px;
}

/* --- 탭 스타일 및 애니메이션 --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    position: relative;
    animation: fadeInUp 0.6s var(--easing) 0.3s both;
}

.tabs::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all var(--animation-medium) var(--easing);
    width: 100px;
    border-radius: 1px;
}

.tab {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--light-text);
    border-bottom: 2px solid transparent;
    transition: all var(--animation-medium) var(--easing);
    position: relative;
    overflow: hidden;
}

.tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(66, 133, 244, 0.1), transparent);
    transition: left var(--animation-slow) var(--easing);
}

.tab:hover::before {
    left: 100%;
}

.tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 500;
}

.tab:hover:not(.active) {
    background-color: var(--hover-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.tab-content {
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--animation-medium) var(--easing);
    display: none;
}

.tab-content.active {
    opacity: 1;
    transform: translateY(0);
    display: block;
    animation: slideInUp 0.4s var(--easing);
}

/* --- 폼 요소 스타일 --- */
.form-group {
    margin-bottom: 16px;
    animation: fadeInUp 0.6s var(--easing) 0.4s both;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--dark-text);
    transition: color var(--animation-fast) ease;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
    transition: all var(--animation-medium) var(--easing);
}

textarea:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
    transform: translateY(-1px);
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.control-group {
    flex: 1;
    min-width: 180px;
    transition: transform var(--animation-medium) var(--easing);
}

.control-group:hover {
    transform: translateY(-2px);
}

select, input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    transition: all var(--animation-medium) var(--easing);
}

select:hover, input[type="number"]:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

input[type="range"] {
    width: 100%;
    margin-top: 8px;
    transition: all var(--animation-fast) ease;
}

input[type="range"]::-webkit-slider-thumb {
    transition: all var(--animation-fast) ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.4);
}

.voice-controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* --- 버튼 스타일 및 애니메이션 --- */
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    animation: fadeInUp 0.6s var(--easing) 0.5s both;
}

button {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
    transition: all var(--animation-medium) var(--easing);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width var(--animation-slow) var(--easing), height var(--animation-slow) var(--easing);
}

button:active::before {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0) scale(0.98);
}

button:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #3367d6;
}

.btn-secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-accent {
    background-color: var(--accent-color);
    color: white;
}

.btn-accent:hover {
    background-color: #d73527;
}

/* --- 오디오 플레이어 --- */
audio {
    width: 100%;
    margin-top: 20px;
    display: none;
    animation: slideInUp 0.4s var(--easing);
    border-radius: 4px;
}

/* --- SSML 태그 --- */
.ssml-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.ssml-tag {
    display: inline-block;
    padding: 6px 12px;
    background-color: var(--hover-color);
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--animation-medium) var(--easing);
    color: var(--primary-color);
    border: 1px solid transparent;
}

.ssml-tag:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(66, 133, 244, 0.3);
}

/* --- 상태 메시지 애니메이션 --- */
.status {
    margin-top: 16px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
    transform: translateY(-10px);
    opacity: 0;
    transition: all var(--animation-medium) var(--easing);
    position: relative;
    overflow: hidden;
}

.status::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left var(--animation-slow) ease;
}

.status.show {
    transform: translateY(0);
    opacity: 1;
    display: block;
    animation: statusSlideIn 0.4s var(--easing);
}

.status.show::before {
    left: 100%;
}

.status.error {
    background-color: #fdeded;
    color: var(--accent-color);
    border: 1px solid #fad2d2;
    border-left: 4px solid var(--accent-color);
}

.status.success {
    background-color: #e6f4ea;
    color: var(--secondary-color);
    border: 1px solid #ceead6;
    border-left: 4px solid var(--secondary-color);
}

.status.info {
    background-color: #e8f0fe;
    color: var(--primary-color);
    border: 1px solid #d2e3fc;
    border-left: 4px solid var(--primary-color);
}

/* --- API 키 섹션 --- */
.api-key-section {
    margin-top: 24px;
    padding: 16px;
    background-color: var(--light-bg);
    border-radius: 4px;
    transition: all var(--animation-medium) var(--easing);
    animation: fadeInUp 0.6s var(--easing) 0.6s both;
}

.api-key-section:hover {
    background-color: #f1f3f4;
    transform: translateY(-1px);
}

.api-key-input {
    width: 100%;
    padding: 8px 40px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: all var(--animation-medium) var(--easing);
}

.api-key-input:focus {
    transform: translateY(-1px);
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: var(--disabled-bg);
    color: var(--disabled-text);
    transition: opacity var(--animation-medium) ease;
}

/* --- 툴팁 --- */
.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 4px;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--dark-text);
    color: white;
    text-align: center;
    border-radius: 4px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--animation-medium) var(--easing);
    font-size: 12px;
    line-height: 1.4;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* --- 로딩 애니메이션 --- */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

.loading-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* --- 푸터 --- */
footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--light-text);
    font-size: 12px;
    animation: fadeInUp 0.6s var(--easing) 0.8s both;
}

/* --- 기록 관련 스타일 --- */
#history-list {
    list-style: none;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all var(--animation-medium) var(--easing);
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInRight 0.4s var(--easing) forwards;
}

.history-item:nth-child(1) { animation-delay: 0.1s; }
.history-item:nth-child(2) { animation-delay: 0.2s; }
.history-item:nth-child(3) { animation-delay: 0.3s; }
.history-item:nth-child(4) { animation-delay: 0.4s; }
.history-item:nth-child(5) { animation-delay: 0.5s; }

.history-item:hover {
    transform: translateX(5px) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary-color);
}

.history-item p {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--dark-text);
}

.history-item p strong {
    color: var(--primary-color);
}

.history-item .text-preview {
    font-style: italic;
    color: var(--light-text);
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.char-counter-display {
    font-size: 12px;
    color: var(--light-text);
    text-align: right;
    margin-top: 4px;
    transition: color var(--animation-fast) ease;
}

.history-item-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.history-item-actions button {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 3px;
}

/* --- API Key visibility toggle --- */
.api-key-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-toggle-btn {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 38px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--light-text);
    padding: 0;
    z-index: 2;
    transition: all var(--animation-medium) var(--easing);
    border-radius: 0 4px 4px 0;
}

.api-key-toggle-btn:hover,
.api-key-toggle-btn:focus {
    color: var(--primary-color);
    background-color: rgba(66, 133, 244, 0.1);
    outline: none;
    transform: scale(1.1);
}

/* --- 유튜브 링크 스타일 --- */
#compareTarget a {
    display: inline-block;
    padding: 5px 5px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    background: linear-gradient(135deg, #ff5858 0%, #f09819 100%);
    border-radius: 50px;
    text-decoration: none;
    transition: all var(--animation-medium) ease;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#compareTarget a:hover {
    background: linear-gradient(135deg, #ff6e6e 0%, #ffba57 100%);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

#compareTarget a:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

#compareTarget a::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
    transition: all var(--animation-slow) ease;
}

#compareTarget a:hover::before {
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    transform: rotate(0);
    background: rgba(255, 255, 255, 0.1);
}

/* --- 화자 진행 상태 표시 --- */
.voice-progress {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--animation-medium) var(--easing);
}

.voice-progress.show {
    opacity: 1;
    transform: translateY(0);
}

.speaker-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--animation-slow) var(--easing);
    position: relative;
    font-weight: bold;
    color: #666;
}

.speaker-indicator.processing {
    background: var(--primary-color);
    color: white;
    animation: speakerPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(66, 133, 244, 0.5);
}

.speaker-indicator.completed {
    background: var(--secondary-color);
    color: white;
    animation: speakerSuccess 0.6s ease-out;
}

.speaker-indicator.waiting {
    opacity: 0.5;
    transform: scale(0.9);
}

/* --- Chirp3 전용 옵션 스타일 --- */
.chirp3-options {
    background-color: #e8f0fe;
    border: 1px solid #d2e3fc;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    margin-bottom: 16px;
    transition: all var(--animation-medium) var(--easing);
    animation: slideInUp 0.4s var(--easing);
}

.chirp3-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark-text);
    margin-bottom: 8px;
    position: relative;
    padding-left: 30px;
}

.chirp3-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all var(--animation-medium) var(--easing);
}

.chirp3-checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

.chirp3-checkbox-label input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.chirp3-checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

.chirp3-help-text {
    display: block;
    color: var(--light-text);
    font-size: 12px;
    line-height: 1.4;
    margin-left: 0;
}

/* --- 키프레임 애니메이션들 --- */


/* --- 키프레임 애니메이션들 --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes statusSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes speakerPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 20px rgba(66, 133, 244, 0.5);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(66, 133, 244, 0.8);
    }
}

@keyframes speakerSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes checkmarkDraw {
    from { stroke-dashoffset: 20; }
    to { stroke-dashoffset: 0; }
}

/* --- 반응형 스타일 --- */
@media (max-width: 1024px) {
    .sidebar-iframe {
        flex: 0 0 200px;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }
    
    .sidebar-iframe {
        flex: 0 0 200px;
        width: 100%;
        height: 300px;
    }
    
    .content-wrapper {
        width: 100%;
        overflow-y: visible;
        padding-right: 0;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .control-row {
        flex-direction: column;
    }
    
    .voice-controls {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
