* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-bg: #0f0f23;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 30px 80px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--dark-bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(102, 126, 234, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(118, 75, 162, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.model-info {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.loading-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary-gradient);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Main Content */
.main-content {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.6s ease-out;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.tab-btn svg {
    width: 20px;
    height: 20px;
}

/* Tab Content */
.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-section label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.input-section input[type="text"],
.input-section textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    resize: vertical;
}

.input-section textarea {
    min-height: 200px;
}

.input-section input[type="text"]:focus,
.input-section textarea:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-section input::placeholder,
.input-section textarea::placeholder {
    color: var(--text-secondary);
}

/* Example Buttons */
.example-buttons {
    display: flex;
    gap: 1rem;
}

.example-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--card-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.file-upload-area:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
}

.file-upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.file-upload-area svg {
    margin-bottom: 1rem;
    opacity: 0.6;
}

.file-upload-area p {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.file-types {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* File Preview */
.file-preview {
    display: none;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
}

.file-preview.show {
    display: block;
}

/* Submit Button */
.submit-btn {
    padding: 1rem 2rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn.loading {
    pointer-events: none;
}

.submit-btn.loading span::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Results Section */
.results-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    animation: fadeIn 0.4s ease-out;
}

.results-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.result-card {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.result-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.result-card .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-card .unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer strong {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Model Selector */
.model-selector-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 16px;
}

/* Advanced Options */
.advanced-options {
    background: rgba(30, 30, 40, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    backdrop-filter: blur(10px);
}

.options-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.options-title::before {
    content: '⚡';
    font-size: 1.2rem;
}

.options-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.option-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.option-item.full-width {
    grid-column: 1 / -1;
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    user-select: none;
    font-weight: 500;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* Input Wrapper & Description */
.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 2px 8px;
    border: 1px solid var(--card-border);
}

.input-wrapper input {
    width: 60px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 4px;
    text-align: right;
}

.input-wrapper input:focus {
    outline: none;
}

.unit-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 4px;
}

.option-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
    margin-left: 30px; /* Align with checkbox text */
}

/* Full Width Input Styles (Generative) */
.option-item.full-width .option-desc {
    margin-left: 0;
    margin-top: 0.5rem;
}

.input-label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.full-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.full-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Adjustments for responsive */
@media (max-width: 768px) {
    .options-group {
        grid-template-columns: 1fr;
    }
}
.model-selector-section label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.model-select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.model-select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.model-description {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Cost Section */
.cost-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.cost-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.cost-card {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.cost-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.cost-card.highlight {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

.cost-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cost-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cost-money {
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Comparison Table */
.comparison-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
}

.comparison-table thead {
    background: rgba(102, 126, 234, 0.1);
}

.comparison-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
}

.comparison-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comparison-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.comparison-table tbody tr.cheapest {
    background: rgba(0, 242, 254, 0.05);
}

.comparison-table tbody tr.cheapest td {
    color: #00f2fe;
    font-weight: 600;
}

.comparison-table .model-name {
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-table .cost-value {
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


.results-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    animation: fadeIn 0.4s ease-out;
}

.cost-money-vnd {
    display: block;
    font-size: 1rem;
    color: #4facfe; /* Light blue from success gradient */
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .tab-navigation {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

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