/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* User Bar (SSO) */
.user-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.logout-link {
    color: white;
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    transition: background 0.2s;
}

.logout-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Main Content */
main {
    padding: 40px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 18px 20px;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    position: relative;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    color: #667eea;
    background: white;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.input-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #667eea;
}

#source-text {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#source-text:focus {
    outline: none;
    border-color: #667eea;
}

.char-count {
    text-align: right;
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* Controls */
.controls {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

.language-selector {
    flex: 1;
    min-width: 200px;
}

.language-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.language-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.language-selector select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn-primary {
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Progress Section */
.progress-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.progress-text {
    text-align: center;
    color: #555;
    font-weight: 500;
}

/* Error Message */
.error-message {
    margin: 20px 0;
    padding: 15px;
    background: #fee;
    border-left: 4px solid #f44;
    border-radius: 4px;
    color: #c33;
}

/* Results Section */
.results-section {
    margin-top: 40px;
}

.results-section h2 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #667eea;
    text-align: center;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.result-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: #fafafa;
    transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.result-header h3 {
    font-size: 1.3rem;
    color: #333;
}

.stats {
    font-size: 0.85rem;
    color: #666;
    text-align: right;
}

.result-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 540px;
    overflow-y: auto;
}

.result-error {
    color: #c33;
    font-style: italic;
}

/* Copy Button */
.btn-copy {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.btn-copy img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.result-header .btn-copy {
    margin-left: auto;
    margin-right: 10px;
}

.btn-copy:hover {
    background: rgba(102, 126, 234, 0.1);
    opacity: 1;
    transform: scale(1.1);
}

.btn-copy:active {
    transform: scale(0.95);
}

.btn-copy.copied {
    opacity: 1;
    background: rgba(40, 167, 69, 0.15);
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

footer .version {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 20px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loading-text::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: #fafafa;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.drop-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.drop-hint {
    color: #999;
    margin: 10px 0;
}

.file-select-btn {
    display: inline-block;
    padding: 10px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.supported-formats {
    margin-top: 15px;
    color: #999;
    font-size: 0.9rem;
}

/* Selected File */
.selected-file {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid #667eea;
}

.file-icon {
    font-size: 2rem;
}

.file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-info span:first-child {
    font-weight: 500;
    color: #333;
}

.file-info span:last-child {
    font-size: 0.85rem;
    color: #666;
}

.btn-remove {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s;
}

.btn-remove:hover {
    color: #c33;
}

/* File Progress */
.progress-container {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.progress-container .progress-bar {
    height: 10px;
    margin-bottom: 8px;
}

.progress-container .progress-fill {
    height: 100%;
}

.progress-container .progress-text {
    font-size: 0.9rem;
}

/* Excel Description */
.excel-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Download Section */
.download-section {
    margin-top: 20px;
    padding: 25px;
    background: #f0f9f0;
    border: 2px solid #4caf50;
    border-radius: 12px;
    text-align: center;
}

.download-message {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 15px;
}

.btn-download {
    display: inline-block;
    padding: 14px 40px;
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3);
    color: white;
}

.btn-download:active {
    transform: translateY(0);
}
