/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #003d7a 0%, #5b21b6 50%, #991b1b 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 60px 0 40px;
}

.logo h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    position: relative;
    
    /* 유리 글씨 효과 */
    background: linear-gradient(
        135deg,
        #003d7a 0%,
        #0066cc 25%,
        #5b21b6 50%,
        #8b5cf6 75%,
        #991b1b 100%
    );
    background-size: 400% 400%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    
    /* 유리 같은 테두리와 그림자 효과 */
    text-shadow: 
        0 0 8px rgba(255, 255, 255, 0.048),
        0 0 16px rgba(255, 255, 255, 0.095);
    
    /* 빛나는 애니메이션 */
    animation: shimmer 20s ease-in-out infinite;
    
    /* 성능 최적화 */
    will-change: background-position, filter;
    transform: translateZ(0);
}



/* 애니메이션 비활성화 설정 고려 */
@media (prefers-reduced-motion: reduce) {
    .logo h1,
    .logo h1::before {
        animation: none;
    }
    
    .logo h1 {
        background-position: 50% 50%;
        filter: brightness(1.2);
    }
}

/* 빛나는 애니메이션 키프레임 */
@keyframes shimmer {
    0% {
        background-position: 200% 200%;
        filter: brightness(1) contrast(1);
    }
    25% {
        background-position: 100% 100%;
        filter: brightness(1.2) contrast(1.1);
    }
    50% {
        background-position: 0% 0%;
        filter: brightness(1.4) contrast(1.2);
    }
    75% {
        background-position: -100% -100%;
        filter: brightness(1.2) contrast(1.1);
    }
    100% {
        background-position: -200% -200%;
        filter: brightness(1) contrast(1);
    }
}



.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Search section */
.search-section {
    width: 100%;
    max-width: 600px;
    margin-bottom: 40px;
    position: relative;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-container:focus-within {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    padding: 20px 24px;
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-weight: 400;
    color: #333;
    background: transparent;
    ime-mode: disabled;
    -webkit-ime-mode: disabled;
    -moz-ime-mode: disabled;
    -ms-ime-mode: disabled;
}

.search-input::placeholder {
    color: #999;
}

.search-button {
    padding: 20px 24px;
    border: none;
    background: #667eea;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    background: #5a67d8;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: #f8f9ff;
}

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

/* Results section */
.results-section {
    width: 100%;
    max-width: 1400px;
    margin-bottom: 40px;
}

.results-header {
    margin-bottom: 24px;
}

.results-header h2 {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
}

.results-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.table-container {
    flex: 1;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.saved-section {
    width: 280px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.saved-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.saved-header h3 {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.header-buttons {
    display: flex;
    gap: 6px;
}

.clear-btn, .copy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.clear-btn:hover, .copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.copy-btn {
    background: rgba(102, 126, 234, 0.3);
}

.copy-btn:hover {
    background: rgba(102, 126, 234, 0.4);
}

.saved-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.saved-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-size: 0.7rem;
    color: white;
    font-family: 'Monaco', 'Menlo', monospace;
    line-height: 1.3;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    user-select: none;
}

.saved-item:last-child {
    margin-bottom: 0;
}

.saved-item:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

.item-content {
    flex: 1;
    pointer-events: none;
}

.remove-indicator {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-left: 8px;
    transition: color 0.2s ease;
    pointer-events: none;
}

.saved-item:hover .remove-indicator {
    color: #ff6b6b;
    font-weight: bold;
}

.no-items {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    text-align: center;
    margin: 0;
    padding: 20px 0;
}

.select-cell {
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    background-color: transparent;
    border-radius: 6px;
    position: relative;
}

.select-cell:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

.select-cell.selected {
    background-color: rgba(102, 126, 234, 0.15);
}

.select-cell.selected:hover {
    background-color: rgba(102, 126, 234, 0.2);
}

.select-icon {
    display: inline-block;
    font-size: 18px;
    color: #666;
    transition: color 0.2s ease;
    pointer-events: none;
}

.select-cell:hover .select-icon {
    color: #333;
}

.select-cell.selected .select-icon {
    color: #667eea;
}

.select-cell.selected:hover .select-icon {
    color: #5a67d8;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    background: #f8f9ff;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.results-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-weight: 400;
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table tr:hover {
    background-color: #f8f9ff;
}

/* Formula section */
.formula-section {
    width: 100%;
    max-width: 600px;
    margin-bottom: 40px;
}

.formula-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.formula-card h4 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.formula {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.70rem;
    font-weight: 400;
    font-family: 'Monaco', 'Menlo', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 10px;
    border-radius: 8px;
    display: inline-block;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.update-info {
    margin-top: 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.update-info a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.update-info a:hover {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

/* Responsive design */
/* 중간 크기 화면 (태블릿) */
@media (max-width: 1024px) {
    .results-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .saved-section {
        width: 100%;
        order: 2;
        max-width: 100%;
    }
    
    .table-container {
        order: 1;
        width: 100%;
    }
    
    .results-table th,
    .results-table td {
        padding: 14px 10px;
        font-size: 0.9rem;
    }
    
    /* 자동완성 최적화 */
    .search-suggestions {
        max-height: 250px;
        border-radius: 12px;
    }
    
    .suggestion-item {
        padding: 12px 16px;
    }
}

/* 768px - 태블릿 */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
        max-width: 100%;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .search-input {
        padding: 16px 18px;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .search-button {
        padding: 16px 18px;
        border-radius: 12px;
    }
    
    .search-suggestions {
        max-height: 200px;
        border-radius: 12px;
        font-size: 0.9rem;
    }
    
    .suggestion-item {
        padding: 12px 16px;
    }
    
    .results-header h2 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }
    
    /* 테이블 최적화 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }
    
    .results-table {
        min-width: 600px;
        width: auto;
    }
    
    .results-table th,
    .results-table td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
    
    .results-table th:first-child,
    .results-table td:first-child {
        min-width: 140px;
        word-break: break-word;
    }
    
    .results-table th:nth-child(2),
    .results-table td:nth-child(2) {
        min-width: 80px;
        text-align: center;
    }
    
    .results-table th:nth-child(3),
    .results-table td:nth-child(3) {
        min-width: 60px;
        text-align: center;
    }
    
    .results-table th:nth-child(4),
    .results-table td:nth-child(4) {
        min-width: 70px;
        text-align: center;
    }
    
    .results-table th:nth-child(5),
    .results-table td:nth-child(5) {
        min-width: 60px;
        text-align: center;
    }
    
    /* 공식 섹션 */
    .formula-card {
        padding: 16px;
    }
    
    .formula {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
}

/* 480px - 모바일 */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .logo h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 32px;
    }
    
    .search-input {
        padding: 14px 16px;
        font-size: 16px; /* iOS 줌 방지 */
        border-radius: 12px;
    }
    
    .search-button {
        padding: 14px 16px;
        border-radius: 12px;
    }
    
    .search-suggestions {
        max-height: 150px;
        font-size: 0.85rem;
        border-radius: 12px;
    }
    
    .suggestion-item {
        padding: 10px 12px;
    }
    
    .results-header h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    /* 테이블 최적화 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }
    
    .results-table {
        min-width: 500px;
        width: auto;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
    
    .results-table th:first-child,
    .results-table td:first-child {
        min-width: 120px;
        word-break: break-word;
    }
    
    .results-table th:nth-child(2),
    .results-table td:nth-child(2) {
        min-width: 70px;
        text-align: center;
    }
    
    .results-table th:nth-child(3),
    .results-table td:nth-child(3) {
        min-width: 50px;
        text-align: center;
    }
    
    .results-table th:nth-child(4),
    .results-table td:nth-child(4) {
        min-width: 60px;
        text-align: center;
    }
    
    .results-table th:nth-child(5),
    .results-table td:nth-child(5) {
        min-width: 50px;
        text-align: center;
    }
    
    /* 공식 섹션 */
    .formula-card {
        padding: 12px;
    }
    
    .formula-card h4 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .formula {
        font-size: 0.65rem;
        padding: 6px 8px;
    }
    
    /* 저장 섹션 */
    .saved-section {
        padding: 12px;
    }
    
    .saved-header h3 {
        font-size: 0.9rem;
    }
    
    .clear-btn, .copy-btn {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    .header-buttons {
        gap: 4px;
    }
    
    .saved-item {
        font-size: 0.65rem;
        padding: 8px 10px;
    }
    
    .remove-indicator {
        font-size: 0.8rem;
    }
} 