/**
 * AI Audio Analysis Tool - Enhanced Stylesheet
 * Version: 4.3
 * Description: Complete styling with Helen Keller brand guidelines, animations, responsive design, and UX enhancements
 */

/* ==========================================================================
   1. CSS Variables (Root) for theming and consistency
   ========================================================================== */
:root {
    /* HKI Brand Colors */
    --hki-purple: #4B2773;
    --hki-purple-dark: #3b1e58;
    --hki-purple-light: #6b4793;
    --hki-dark-text: #2c3e50;
    --hki-light-text: #555;
    --hki-light-grey: #f0f0f0;
    --hki-white: #ffffff;
    
    /* UI Component Colors */
    --primary-button-bg: var(--hki-purple);
    --primary-button-hover-bg: var(--hki-purple-dark);
    --background-color: var(--hki-light-grey);
    --card-background: var(--hki-white);
    --border-color: #ddd;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    
    /* Fonts */
    --font-family: 'Open Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    
    /* Shadows and Effects */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}


/* ==========================================================================
   2. General Body and Layout Styles
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--hki-dark-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    width: 90%;
    margin: 20px auto;
    flex-grow: 1;
}

main {
    padding: 0 20px;
}


/* ==========================================================================
   3. Header Styles
   ========================================================================== */
.hki-header {
    background: linear-gradient(135deg, var(--hki-purple) 0%, var(--hki-purple-light) 100%);
    color: var(--hki-white);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.hki-logo img {
    height: 45px;
    max-width: 100%;
    vertical-align: middle;
    filter: brightness(1.1);
}

.hki-title {
    margin: 0;
    font-size: 2em;
    font-weight: 300;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}


/* ==========================================================================
   4. Card and Form Styles
   ========================================================================== */
.card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    position: relative;
}

.card-header h2 {
    margin: 0;
    color: var(--hki-purple);
}

.info-btn {
    background: var(--info-color);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    text-transform: none;
    line-height: 1;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.info-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 0;
    color: var(--hki-dark-text);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--hki-light-text);
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--hki-dark-text);
    background-color: var(--hki-white);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--hki-purple);
    box-shadow: 0 0 0 3px rgba(75, 39, 115, 0.1);
}

/* Field validation states */
.field-valid {
    border-color: var(--success-color) !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2327ae60" stroke-width="2"><polyline points="20 6 9 17 4 12"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

.field-invalid {
    border-color: var(--error-color) !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23e74c3c" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.file-info {
    display: block;
    margin-top: 5px;
    color: var(--hki-light-text);
    font-size: 0.85em;
}


/* ==========================================================================
   5. Button Styles
   ========================================================================== */
button {
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: linear-gradient(135deg, var(--hki-purple) 0%, var(--hki-purple-light) 100%);
    color: var(--hki-white);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--hki-purple-dark) 0%, var(--hki-purple) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.primary-btn:disabled {
    background: linear-gradient(270deg, var(--hki-purple-light), var(--hki-purple), var(--hki-purple-light));
    background-size: 200% 100%;
    animation: processingGradient 2s ease infinite;
    cursor: not-allowed;
    transform: none;
    color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(75, 39, 115, 0.3);
}

@keyframes processingGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.secondary-btn {
    background-color: #f8f9fa;
    color: var(--hki-dark-text);
    font-size: 0.85rem;
    padding: 8px 16px;
    border: 2px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: var(--hki-purple);
    color: var(--hki-white);
    border-color: var(--hki-purple);
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Spinner Animation */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* File Input Custom Styling */
input[type="file"] {
    padding: 8px;
    background: var(--background-color);
    border: 2px dashed var(--hki-purple);
}

input[type="file"]::file-selector-button {
    background: var(--hki-purple);
    color: var(--hki-white);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 15px;
    transition: var(--transition);
}

input[type="file"]::file-selector-button:hover {
    background: var(--hki-purple-dark);
}

/* Drag and Drop Zone */
.drop-zone {
    border: 3px dashed var(--hki-purple);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(75, 39, 115, 0.03) 0%, rgba(107, 71, 147, 0.05) 100%);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover {
    border-color: var(--hki-purple-dark);
    background: linear-gradient(135deg, rgba(75, 39, 115, 0.08) 0%, rgba(107, 71, 147, 0.1) 100%);
    transform: scale(1.01);
}

.drop-zone.drag-over {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(39, 174, 96, 0.15) 100%);
    border-width: 4px;
}

.drop-zone-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.drop-zone-text {
    color: var(--hki-dark-text);
    margin: 10px 0;
}

.drop-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    border: none;
    pointer-events: auto;
}

/* File Preview */
.file-preview {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    background: var(--background-color);
    border: 2px solid var(--border-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-preview-content.success {
    border-left: 4px solid var(--success-color);
    padding-left: 15px;
}

.file-preview-content.warning {
    border-left: 4px solid var(--warning-color);
    padding-left: 15px;
    background: rgba(243, 156, 18, 0.05);
}

.file-preview-content.error {
    border-left: 4px solid var(--error-color);
    padding-left: 15px;
    background: rgba(231, 76, 60, 0.05);
}

.status-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.file-details {
    flex-grow: 1;
}

.file-details strong {
    display: block;
    color: var(--hki-dark-text);
    margin-bottom: 5px;
    word-break: break-word;
}

.file-details p {
    margin: 3px 0;
    font-size: 0.9em;
    color: var(--hki-light-text);
}

.status-message {
    font-weight: 600;
    color: var(--hki-dark-text);
}


/* ==========================================================================
   6. Progress Bar Styles
   ========================================================================== */
.progress-container {
    margin: 20px 0;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background-color: var(--background-color);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hki-purple), var(--hki-purple-light));
    border-radius: 15px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--hki-dark-text);
    font-weight: 600;
    font-size: 0.9em;
}


/* ==========================================================================
   7. Log and Result Area Styles
   ========================================================================== */
.log-container {
    background-color: #1a1d23;
    color: #d4d4d4;
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 15px 18px;
    border-radius: 8px;
    height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid rgba(75, 39, 115, 0.2);
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.log-container::before {
    content: '● ● ●';
    display: block;
    color: #555;
    font-size: 0.75em;
    letter-spacing: 4px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a2d35;
}

.log-container:empty::after {
    content: 'Waiting for input...';
    color: #555;
    font-style: italic;
    display: block;
    text-align: center;
    margin-top: 50px;
}

.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #2c2c2c;
}

.log-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.log-entry {
    white-space: pre-wrap;
    margin-bottom: 5px;
    padding: 3px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-entry.error {
    color: #f48771;
    background: rgba(231, 76, 60, 0.1);
    padding: 5px;
    border-left: 3px solid var(--error-color);
}

.log-entry.success {
    color: #4ec9b0;
    background: rgba(39, 174, 96, 0.1);
    padding: 5px;
    border-left: 3px solid var(--success-color);
}

.log-entry.warning {
    color: #dcdcaa;
    background: rgba(243, 156, 18, 0.1);
    padding: 5px;
    border-left: 3px solid var(--warning-color);
}

.log-entry.info {
    color: #9cdcfe;
    background: rgba(52, 152, 219, 0.1);
    padding: 5px;
    border-left: 3px solid var(--info-color);
}

#result-text {
    background: #f8f9fa;
    border: 2px solid var(--border-color);
    font-size: 1rem;
    line-height: 1.6;
}


/* ==========================================================================
   7.5. Result Actions & Layout
   ========================================================================== */

.result-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-actions .secondary-btn {
    flex-grow: 1;
    min-width: 200px; /* Ensure buttons don't get too small */
}

.process-another-btn {
    background-color: transparent !important;
    color: var(--hki-purple) !important;
    border: 2px solid var(--hki-purple) !important;
    font-weight: 600;
}

.process-another-btn:hover {
    background-color: var(--hki-purple) !important;
    color: var(--hki-white) !important;
}

#results-area {
    margin-top: 20px;
}


/* ==========================================================================
   8. History Section Styles
   ========================================================================== */
.history-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    background: var(--background-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.history-item:hover {
    border-color: var(--hki-purple);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-title {
    font-weight: 600;
    color: var(--hki-purple);
}

.history-item-date {
    font-size: 0.85em;
    color: var(--hki-light-text);
}

.history-item-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: var(--hki-light-text);
}

.history-item-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.no-history {
    text-align: center;
    color: var(--hki-light-text);
    padding: 40px;
    font-style: italic;
}


/* ==========================================================================
   9. Footer Styles
   ========================================================================== */
footer {
    width: 100%;
    text-align: center;
    padding: 25px 0;
    margin-top: 40px;
    background: linear-gradient(135deg, var(--hki-purple) 0%, var(--hki-purple-light) 100%);
    color: var(--hki-white);
    font-size: 0.85em;
}

footer p {
    margin: 8px 20px;
}

footer a {
    color: var(--hki-white);
    text-decoration: underline;
    font-weight: 600;
}

footer a:hover {
    text-decoration: none;
    opacity: 0.9;
}

.version-info {
    opacity: 0.8;
    font-size: 0.9em;
    margin-top: 10px;
}


/* ==========================================================================
   10. Responsive Media Queries
   ========================================================================== */
@media (max-width: 768px) {
    .hki-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    .hki-title {
        font-size: 1.5em;
    }

    .container {
        width: 95%;
        margin: 10px auto;
    }

    main {
        padding: 0 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .button-group {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .hki-title {
        font-size: 1.3em;
    }

    .hki-logo img {
        height: 35px;
    }

    .card {
        padding: 20px;
    }

    h2 {
        font-size: 1.3em;
    }

    .secondary-btn {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}


/* ==========================================================================
   11. Utility Classes
   ========================================================================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ============================================
   DROPDOWN STYLING FIXES - Added for 500MB support
   ============================================ */

/* Fix for dropdown selects to fill their containers */
select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background-color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

/* Hover state for dropdowns */
select:hover {
    border-color: #4B2773;
}

/* Focus state for dropdowns */
select:focus {
    outline: none;
    border-color: #4B2773;
    box-shadow: 0 0 0 3px rgba(75, 39, 115, 0.1);
}

/* Style for the form grid to ensure proper spacing */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* For the full-width elements like prompt and file upload */
.form-group.full-width {
    grid-column: 1 / -1;
}

/* Ensure form groups take full width */
.form-group {
    width: 100%;
}

/* Label styling */
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Textarea styling to match */
textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #4B2773;
    box-shadow: 0 0 0 3px rgba(75, 39, 115, 0.1);
}

/* File upload button styling */
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    border-color: #4B2773;
    background: #f5f0ff;
}

/* Custom file upload button (if using the Choose File button) */
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    background-color: #4B2773;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    margin-right: 15px;
    transition: background-color 0.3s ease;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
    background-color: #3b1e58;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* On medium screens, make the recording type full width */
    .form-group:nth-child(3) {
        grid-column: 1 / -1;
    }
}

/* Additional fix to ensure dropdowns don't overflow their containers */
* {
    box-sizing: border-box;
}

/* If your form is inside a container with padding, ensure proper width calculation */
form {
    width: 100%;
}

/* Ensure the card/container has proper padding */
.card {
    padding: 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* ==========================================================================
   12. Translation Controls & Tabs Styling
   ========================================================================== */

/* Translation Controls */
.translation-controls {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.translation-control-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.translation-control-group label {
    font-weight: 600;
    color: var(--hki-purple);
    margin: 0;
    font-size: 1rem;
    text-transform: none;
}

.translation-control-group select {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.translate-btn {
    padding: 10px 30px;
    width: auto;
    min-width: 150px;
}

/* Result Tabs */
.result-tabs {
    display: flex;
    gap: 5px;
    margin: 20px 0 0 0;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--hki-light-text);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-transform: none;
}

.tab-button:hover {
    background: var(--background-color);
    color: var(--hki-purple);
}

.tab-button.active {
    color: var(--hki-purple);
    border-bottom-color: var(--hki-purple);
    background: transparent;
}

/* Tab Content */
.tab-content-wrapper {
    position: relative;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.tab-content textarea {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* ==========================================================================
   13. Modal Styling
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.modal-content.modal-wide {
    max-width: 680px;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--hki-purple) 0%, var(--hki-purple-light) 100%);
    color: var(--hki-white);
    padding: 18px 24px 14px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.modal-subtitle {
    margin: 4px 0 0 !important;
    font-size: 0.85em;
    opacity: 0.85;
    color: var(--hki-white) !important;
}

.modal-body {
    padding: 20px 24px 16px;
    line-height: 1.5;
}

.modal-body p {
    margin: 8px 0;
    color: var(--hki-dark-text);
}

.modal-body ul {
    list-style-type: none;
    padding-left: 15px;
}

.modal-body li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.modal-body li::before {
    content: '✓';
    color: var(--success-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.modal-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

/* Steps grid inside instructions modal */
.modal-steps {
    display: flex;
    gap: 12px;
    margin: 0 0 12px;
}

.modal-step {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--background-color);
    border-radius: 8px;
    border-top: 3px solid var(--hki-purple);
}

.step-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    background: var(--hki-purple);
    color: var(--hki-white);
    font-weight: 700;
    font-size: 0.85em;
}

.step-text {
    flex: 1;
    min-width: 0;
}

.modal-step .step-title {
    font-weight: 700;
    font-size: 0.88em;
    margin: 0 0 2px;
    color: var(--hki-dark-text);
}

.modal-step .step-desc {
    font-size: 0.8em;
    color: var(--hki-light-text);
    margin: 0;
    line-height: 1.35;
}

.modal-link {
    text-align: center;
    font-size: 0.85em;
    margin: 0 !important;
    color: var(--hki-light-text) !important;
}

.modal-link a {
    color: var(--hki-purple);
    font-weight: 600;
}

.modal-footer {
    padding: 14px 24px;
    background: var(--background-color);
    display: flex;
    gap: 15px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.modal-footer button {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-footer .secondary-btn {
    background-color: var(--hki-light-grey);
    border-color: #ccc;
}

.modal-footer .secondary-btn:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
    color: var(--hki-dark-text);
}

/* ==========================================================================
   14a. User Identification Modal
   ========================================================================== */

.user-id-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-id-form label {
    font-weight: 600;
    color: var(--hki-dark-text);
    font-size: 0.95rem;
}

.user-id-form input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.user-id-form input[type="email"]:focus {
    border-color: var(--hki-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(104, 55, 141, 0.15);
}

.user-id-hint {
    color: var(--hki-light-text);
    font-size: 0.82rem;
    line-height: 1.4;
}

#user-id-modal .modal-footer {
    justify-content: flex-end;
}

#user-id-modal .modal-footer button {
    flex: 0 0 auto;
    min-width: 140px;
}

/* ==========================================================================
   14. Responsive Updates for Translation Features
   ========================================================================== */

@media (max-width: 768px) {
    .translation-control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .translation-control-group select,
    .translate-btn {
        width: 100%;
        max-width: none;
    }
    
    .result-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 0 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }

    .modal-steps {
        flex-direction: column;
    }
}

/* ==========================================================================
   15. Translation Status Indicators
   ========================================================================== */

.translation-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 8px;
}

.translation-status.loading {
    background: var(--info-color);
    color: white;
}

.translation-status.complete {
    background: var(--success-color);
    color: white;
}

.translation-status.error {
    background: var(--error-color);
    color: white;
}

/* Close button for tabs */
.tab-close {
    margin-left: 8px;
    opacity: 0.6;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
}

.tab-close:hover {
    opacity: 1;
    color: var(--error-color);
}

/* ==========================================================================
   Mode Switcher
   ========================================================================== */
.mode-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background-color: var(--hki-white);
    border-radius: 8px;
    padding: 5px;
    box-shadow: var(--shadow-sm);
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    background-color: transparent;
    color: var(--hki-light-text);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-btn:hover {
    background-color: var(--background-color);
    color: var(--hki-purple);
}

.mode-btn.active {
    background: var(--hki-purple);
    color: var(--hki-white);
    box-shadow: var(--shadow-md);
}

.beta-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    font-size: 0.7em;
    font-weight: 700;
    color: var(--hki-purple);
    background-color: var(--hki-white);
    border: 1px solid var(--hki-purple);
    border-radius: 10px;
    vertical-align: middle;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.mode-btn.active .beta-tag {
    color: var(--hki-white);
    background-color: var(--hki-purple);
    border-color: var(--hki-white);
}