/* Content Engine - Upload UI Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

header .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Upload Container */
.upload-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-color);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.dropzone-content {
    pointer-events: none;
}

.upload-icon {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.dropzone-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dropzone-or {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.browse-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s;
}

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

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-top: 16px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-details svg {
    color: var(--primary-color);
}

.file-name {
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.remove-btn {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Progress */
.progress {
    margin-top: 24px;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 12px;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    transition: all 0.2s;
}

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

.submit-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Result & Error */
.result,
.error {
    text-align: center;
    padding: 24px 0;
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.result-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.result-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.result h3,
.error h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.result-info {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.error-text {
    color: var(--error-color);
    margin-bottom: 24px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--success-color);
    color: white;
    text-decoration: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

.download-btn:hover {
    background: #059669;
}

.convert-another-btn,
.try-again-btn {
    display: block;
    width: 100%;
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s;
}

.convert-another-btn:hover,
.try-again-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 32px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 8px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

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

/* Dropzone hint */
.dropzone-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: -4px;
    margin-bottom: 8px;
}

/* File List (multiple files) */
.file-list {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.file-list-header span {
    font-weight: 500;
    color: var(--text-primary);
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
}

.clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.file-list ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: white;
    border: 1px solid var(--border-color);
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-item-info svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.file-item-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.file-item-size {
    color: var(--text-secondary);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Download List (multiple results) */
.download-list {
    margin-top: 16px;
    max-height: 250px;
    overflow-y: auto;
}

.download-list ul {
    list-style: none;
}

.download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--bg-color);
}

.download-item.success {
    border-left: 3px solid var(--success-color);
}

.download-item.failed {
    border-left: 3px solid var(--error-color);
}

.download-item-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 12px;
}

.download-item-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-color);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.download-item-btn:hover {
    background: #059669;
}

.download-item-error {
    color: var(--error-color);
    font-size: 0.85rem;
}

/* File Type Selector */
.file-type-selector {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.type-option {
    flex: 1;
    cursor: pointer;
}

.type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    background: var(--bg-color);
}

.type-card svg {
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: color 0.2s;
}

.type-card strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.type-card small {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.type-option input[type="radio"]:checked + .type-card {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.type-option input[type="radio"]:checked + .type-card svg {
    color: var(--primary-color);
}

.type-option:hover .type-card {
    border-color: var(--primary-color);
}

/* InDesign Options */
.indesign-options {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.input-type-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.indesign-options select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
}

.indesign-options select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Warnings */
.warnings {
    margin-top: 16px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
}

.warning-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b45309;
    margin-bottom: 12px;
}

.warning-header svg {
    color: #f59e0b;
}

.warnings ul {
    list-style: none;
    padding-left: 28px;
}

.warnings li {
    position: relative;
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.warnings li::before {
    content: "•";
    position: absolute;
    left: -16px;
    color: #f59e0b;
}

/* ============================================
   Authentication Styles - Modern Design
   ============================================ */

.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.auth-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.2s;
}

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

.form-group input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-group input::placeholder {
    color: #94a3b8;
}

.form-group input:hover {
    border-color: #cbd5e1;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group input:focus + .input-icon,
.form-group input:focus ~ .input-icon {
    color: var(--primary-color);
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary-color);
}

.auth-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

.auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.5);
}

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

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn .btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-btn .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.auth-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    color: var(--error-color);
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-error::before {
    content: '⚠';
    font-size: 1.1rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 16px;
}

.auth-footer {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer p {
    margin: 0;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Password strength indicator */
.password-strength {
    margin-top: 8px;
    display: flex;
    gap: 4px;
}

.password-strength .bar {
    height: 4px;
    flex: 1;
    background: var(--border-color);
    border-radius: 2px;
    transition: background 0.2s;
}

.password-strength.weak .bar:nth-child(1) {
    background: var(--error-color);
}

.password-strength.medium .bar:nth-child(1),
.password-strength.medium .bar:nth-child(2) {
    background: #f59e0b;
}

.password-strength.strong .bar {
    background: var(--success-color);
}

/* Auth page specific body */
.auth-page .container {
    max-width: 100%;
    padding: 0;
}

.auth-page header {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

.auth-page footer {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}

/* ============================================
   Dashboard Styles
   ============================================ */

.dashboard-container {
    max-width: 800px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: var(--error-color);
    color: var(--error-color);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.card-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.profile-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-info .info-row:last-child {
    border-bottom: none;
}

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

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.badge-user {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge-admin {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.api-key-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.api-key-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.api-key-display code {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.copy-btn:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.secondary-btn {
    width: 100%;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-buttons {
    display: flex;
    gap: 16px;
}

.action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
}

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

.action-btn.secondary {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.action-btn.secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ============================================
   Navigation
   ============================================ */

.nav-links {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 24px 16px;
    }

    .upload-container {
        padding: 24px 16px;
    }

    .dropzone {
        padding: 32px 16px;
    }

    .file-info {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .file-details {
        flex-direction: column;
    }

    .file-type-selector {
        flex-direction: column;
    }

    /* Auth responsive */
    .auth-container {
        padding: 24px 16px;
        min-height: auto;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .auth-card h2 {
        font-size: 1.5rem;
    }

    .auth-icon {
        width: 56px;
        height: 56px;
    }

    .auth-icon svg {
        width: 28px;
        height: 28px;
    }

    .form-group input {
        padding: 12px 14px 12px 42px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

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

    .action-buttons {
        flex-direction: column;
    }
}
