:root {
    --primary: #132190;
    --primary-hover: #0d1660;
    --primary-light: rgba(19, 33, 144, 0.1);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.1);
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Skip Link - Accessibility */
.skip-link {
    position: fixed;
    top: 0;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    z-index: 1001;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
    transform: translateY(-100%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid var(--warning);
    outline-offset: 2px;
}


/* Visually Hidden - For screen readers only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.back-link,
.back-link:visited,
.back-link:link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 0.5rem;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary);
}

.header-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #010451 0%, var(--primary) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-lg);
}

.header-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.header p {
    color: var(--gray-500);
    font-size: 1.05rem;
}

/* Steps */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.step {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.step:hover {
    box-shadow: var(--shadow-lg);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* Accordion trigger button styling */
.accordion-trigger {
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    text-align: left;
    border-radius: var(--radius-sm);
    margin-bottom: 0;
}

.accordion-trigger:hover {
    background: var(--gray-50);
}

.accordion-trigger:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.step-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-icon svg {
    width: 18px;
    height: 18px;
}

.step-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.step-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-left: auto;
}

/* File upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 3rem 1.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--gray-50);
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.02);
}

.file-upload:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload.has-file {
    border-color: var(--success);
    border-style: solid;
    background: var(--success-light);
    padding: 2rem 1.5rem;
}

.file-upload.has-file:hover {
    border-color: var(--warning);
    background: var(--warning-light);
}

.file-upload.has-file.dragover-replace {
    border-color: var(--warning);
    background: var(--warning-light);
    border-style: solid;
    transform: scale(1.02);
}

.file-upload.has-file .file-upload-icon {
    display: none;
}

.file-upload.has-file .file-upload-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.replace-indicator {
    display: none;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--warning);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
}

.file-upload.dragover-replace .replace-indicator {
    display: block;
}

.file-upload input {
    display: none;
}

.file-upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--gray-400);
    transition: var(--transition);
}

.file-upload:hover .file-upload-icon {
    color: var(--primary);
}

.file-upload.has-file .file-upload-icon {
    color: var(--success);
}

.file-upload-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.file-upload-hint {
    font-size: 0.875rem;
    color: var(--gray-600); /* Improved contrast: was gray-400 */
}

.file-upload-status {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--success);
    font-weight: 500;
}

/* Image preview */
.image-preview {
    margin-top: 1.5rem;
    position: relative;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: block;
    margin: 0 auto;
}

.btn-remove {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: auto;
}

.btn-remove:hover {
    background: #dc2626;
}

.btn-remove svg {
    width: 16px;
    height: 16px;
}

/* API Configuration */
.api-config {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    flex: 1;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--gray-800);
    transition: var(--transition);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-icon {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--gray-400);
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--gray-600);
}

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

.input-hint {
    font-size: 0.75rem;
    color: var(--gray-600); /* Improved contrast: was gray-500 */
}

.input-hint a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.input-hint a:hover {
    text-decoration: underline;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-wrapper label {
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

/* Warning banner */
.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
}

.warning-banner svg {
    width: 20px;
    height: 20px;
    color: var(--warning);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.warning-banner span {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Toggle buttons - Vertical Radio */
.toggle-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-btn-radio {
    padding: 1rem 1.25rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toggle-btn-radio:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.toggle-btn-radio.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.toggle-btn-radio:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.radio-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: var(--transition);
}

.toggle-btn-radio.active .radio-circle {
    border-color: var(--primary);
}

.toggle-btn-radio.active .radio-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.radio-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1rem;
}

.radio-description {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-left: 2.75rem;
}

/* Config grid */
.config-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--gray-800);
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-group input[type="number"] {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--gray-800);
    transition: var(--transition);
    margin-top: 0.5rem;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Toggle group horizontal */
.toggle-group {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-btn:hover {
    color: var(--gray-800);
}

.toggle-btn.active {
    background: white;
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
}

.toggle-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    z-index: 1;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #010451 0%, var(--primary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(19, 33, 144, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(19, 33, 144, 0.5);
}

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

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-primary:focus {
    outline: 3px solid var(--gray-900);
    outline-offset: 2px;
}

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

.btn-secondary {
    width: 100%;
    padding: 1rem 2rem;
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-secondary:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

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

/* Results section */
.results-section {
    display: none;
}

.results-section.visible {
    display: block;
}

.success-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.success-banner svg {
    width: 24px;
    height: 24px;
    color: var(--success);
    flex-shrink: 0;
}

.success-banner span {
    font-weight: 500;
    color: var(--gray-800);
}

.result-container {
    margin-bottom: 1.5rem;
}

.result-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-image-preview {
    position: sticky;
    top: 1rem;
    align-self: start;
    margin-top: 38px;
}

.result-image-preview img {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--gray-200);
}

.result-text-area {
    display: flex;
    flex-direction: column;
}

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

.result-header label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.char-counter {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

#generatedAltText {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--gray-800);
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    background: var(--primary-light);
}

#generatedAltText:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Compliance indicator - Visual meter */
.compliance-indicator {
    margin-top: 1rem;
}

.compliance-meter {
    position: relative;
    width: 100%;
}

.meter-container {
    width: 100%;
    position: relative;
    padding-top: 30px;
}

.meter-track {
    height: 12px;
    background: linear-gradient(to right,
        var(--success) 0%,
        var(--success) 41.67%,
        var(--warning) 41.67%,
        var(--warning) 83.33%,
        var(--error) 83.33%,
        var(--error) 100%);
    border-radius: 999px;
    position: relative;
    overflow: visible;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.meter-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 0.7rem;
    color: var(--gray-500);
    font-weight: 500;
}

.meter-marker {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.meter-marker:nth-child(1) {
    left: 0%;
    transform: translateX(0);
}

.meter-marker:nth-child(2) {
    left: 41.67%;
}

.meter-marker:nth-child(3) {
    left: 83.33%;
}

.meter-marker:nth-child(4) {
    left: 100%;
    transform: translateX(-100%);
}

.meter-marker-line {
    width: 2px;
    height: 16px;
    background: var(--gray-300);
    margin-top: 4px;
}

.meter-indicator {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: white;
    border: 3px solid;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meter-indicator svg {
    width: 14px;
    height: 14px;
}

.meter-indicator.excellent {
    border-color: var(--success);
    color: var(--success);
}

.meter-indicator.good {
    border-color: var(--warning);
    color: var(--warning);
}

.meter-indicator.poor {
    border-color: var(--error);
    color: var(--error);
}

.meter-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-900);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.meter-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-900);
}

.compliance-meter:hover .meter-tooltip {
    opacity: 1;
}

.compliance-decorative {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--gray-800);
}

.compliance-decorative svg {
    width: 18px;
    height: 18px;
    color: var(--gray-500);
    flex-shrink: 0;
}

/* Result actions */
.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* History section */
.history-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.history-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.history-item {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    color: var(--gray-700);
}

.history-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

/* Guidelines section */
.guidelines-content {
    margin-top: 1.25rem;
}

.guidelines-content.hidden {
    display: none;
}

.expander-arrow {
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    transition: var(--transition);
    margin-left: auto;
}

.expander-arrow.open {
    transform: rotate(180deg);
}

.guideline-section {
    margin-bottom: 1.5rem;
}

.guideline-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.guideline-section p {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.guideline-section ul {
    list-style: none;
    padding: 0;
}

.guideline-section ul li {
    font-size: 0.875rem;
    color: var(--gray-600);
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.guideline-section ul li::before {
    content: '•';
    position: absolute;
    left: 0.5rem;
    color: var(--primary);
    font-weight: bold;
}

.guideline-section ul li strong {
    color: var(--gray-800);
}

/* Example grid */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.example-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid;
}

.example-card.good {
    background: var(--success-light);
    border-color: var(--success);
}

.example-card.bad {
    background: var(--error-light);
    border-color: var(--error);
}

.example-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.example-card code {
    display: block;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.example-card p {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.external-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.external-link:hover {
    background: var(--primary);
    color: white;
}

.external-link svg {
    width: 16px;
    height: 16px;
}

/* Loading overlay */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
}

.loading-overlay.visible {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Hidden state */
.hidden {
    display: none !important;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gray-900);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast svg {
    width: 20px;
    height: 20px;
    color: var(--success);
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
}

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

    .header h1 {
        font-size: 1.5rem;
    }

    .step {
        padding: 1.25rem;
    }

    .result-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .result-image-preview {
        position: relative;
    }

    .result-image-preview img {
        max-height: 300px;
        object-fit: contain;
    }

    .result-actions {
        grid-template-columns: 1fr;
    }

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

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: calc(100% - 2rem);
    }
}
