:root {
    /* Google Material Design Palette */
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --border-color: #dadce0;
    
    --text-primary: #202124;
    --text-secondary: #5f6368;
    
    --primary-color: #1a73e8;
    --primary-hover: #1b66c9;
    
    --success: #1e8e3e;
    --error: #d93025;
    
    --radius-small: 4px;
    --radius-medium: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Google usually uses Roboto, Inter is a great fallback */
    font-family: 'Roboto', 'Inter', system-ui, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

/* Layout */
.container {
    max-width: 1000px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

header .highlight {
    color: var(--primary-color);
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* Bento Grid -> Simple Grid */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
}

.bento-item {
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-medium);
    border: 1px solid var(--border-color);
    /* No shadows, no relief, pure flat design */
}

/* Sections */
.upload-section {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    min-height: 220px;
    border: 1px dashed var(--border-color);
}

.upload-section.drag-active {
    background: rgba(26, 115, 232, 0.04);
    border-color: var(--primary-color);
}

.options-section {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.output-section, .ai-section {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
}

/* Typography in cards */
h2, h3 {
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.icon-container {
    font-size: 2.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    font-size: inherit;
    padding: 2px 4px;
    border-radius: var(--radius-small);
}

.text-btn:hover {
    background: rgba(26, 115, 232, 0.04);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-small);
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    width: 100%;
}

.file-info span {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.icon-btn:hover {
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

/* Options Section */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Clean Toggle */
.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-container input {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.toggle-container input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-slider {
    display: none; /* Removed custom slider for standard checkbox look, or flat material look */
}

.toggle-label {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.toggle-container input:disabled ~ .toggle-label {
    color: var(--text-secondary);
}

/* Buttons */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-small);
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    transition: background 0.2s;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

.primary-btn:disabled {
    background: #e8eaed;
    color: #9aa0a6;
    cursor: not-allowed;
}

.secondary-btn {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-small);
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(26, 115, 232, 0.04);
}

.secondary-btn:disabled {
    border-color: #e8eaed;
    color: #9aa0a6;
    cursor: not-allowed;
}

/* Output Section */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.output-header h3 {
    margin-bottom: 0;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-buttons .primary-btn {
    width: auto;
}

.textarea-container {
    flex: 1;
    min-height: 200px;
}

textarea {
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-small);
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

textarea:focus {
    border-color: var(--primary-color);
    border-width: 2px;
    padding: calc(1rem - 1px); /* Prevent shifting */
}

textarea::placeholder {
    color: var(--text-secondary);
}

/* Input elements */
.api-key-container label {
    color: var(--text-primary);
}

input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-small);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

input[type="password"]:focus {
    border-color: var(--primary-color);
    border-width: 2px;
    padding: calc(0.75rem - 1px);
}

/* Responsive */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-section, .options-section, .output-section, .ai-section {
        grid-column: 1 / -1;
    }

    header h1 {
        font-size: 2rem;
    }
    
    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .action-buttons {
        width: 100%;
    }
    
    .action-buttons button {
        flex: 1;
        justify-content: center;
    }
}
