/* ===== Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

/* ===== Auth Loader ===== */
.auth-loader {
    position: fixed;
    inset: 0;
    background: #f3f4f6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auth-loader__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.auth-loader__text {
    margin-top: 16px;
    color: #6b7280;
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== App Wrapper ===== */
.app-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* ===== Translator Container ===== */
.translator-container {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 480px;
}

/* ===== App Header ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.app-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 22px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #6b7280;
}

.user-info.d-none { display: none !important; }

.btn-logout {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    width: auto;
    margin: 0;
}

.btn-logout:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

/* ===== Form Elements ===== */
label {
    display: block;
    margin-top: 14px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #4b5563;
    font-size: 14px;
}

textarea,
select,
input[type="text"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 5px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
    background-color: #fff;
}

textarea {
    height: 90px;
    resize: vertical;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* ===== Contenteditable output with tag highlighting ===== */
.editable-highlight-box {
    width: 100%;
    min-height: 120px;
    max-height: 250px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 15px;
    background-color: #fff;
    white-space: pre-wrap;
    word-wrap: break-word;
    outline: none;
    transition: border-color 0.2s;
}

.editable-highlight-box:focus {
    border-color: #3b82f6;
}

/* ===== Speech tag chip ===== */
.speech-tag {
    background-color: #ffedd5;
    color: #ea580c;
    border: 1px dashed #fdba74;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* ===== Help / tags dropdown ===== */
.help-container {
    margin-top: 5px;
    margin-bottom: 15px;
}

.help-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    margin: 0;
}

.help-btn:hover { text-decoration: underline; }

.tags-dropdown {
    display: none;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    margin-top: 5px;
    font-size: 13px;
    max-height: 150px;
    overflow-y: auto;
}

.tag-item {
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
}

.tag-item:hover {
    background-color: #f3f4f6;
    color: #2563eb;
}

.tag-code {
    font-family: monospace;
    font-weight: bold;
    color: #ea580c;
}

/* ===== Action buttons ===== */
button.action-btn {
    width: 100%;
    padding: 12px;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 15px;
    margin-bottom: 5px;
}

button.action-btn:hover:not(:disabled) {
    background-color: #2563eb;
}

button:disabled {
    background-color: #9ca3af !important;
    cursor: not-allowed;
}

#generateBtn {
    background-color: #7c3aed;
}

#generateBtn:hover:not(:disabled) {
    background-color: #6d28d9;
}

/* ===== Audio Player ===== */
.audio-wrapper {
    margin-top: 20px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

audio {
    width: 100%;
    outline: none;
}

.btn-download {
    background-color: #10b981;
    margin-top: 10px;
    margin-bottom: 0;
}

.btn-download:hover:not(:disabled) {
    background-color: #059669;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}
