/* ========================================
   AI Reader - Publish Console Styles
   For: index.html, pdf.html
   Flat, Modern, Professional Design
   ======================================== */

/* ----------------------------------------
   Layout & Container
   ---------------------------------------- */
.console-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--app-space-8) var(--app-space-5);
}

/* ----------------------------------------
   Header
   ---------------------------------------- */
.console-header {
    text-align: center;
    margin-bottom: var(--app-space-8);
}

.console-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--app-text);
    margin-bottom: var(--app-space-3);
    letter-spacing: -0.02em;
}

.console-header p {
    color: var(--app-text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ----------------------------------------
   Cards - Flat Design
   ---------------------------------------- */
.console-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    padding: var(--app-space-6);
    box-shadow: var(--app-shadow-sm);
    margin-bottom: var(--app-space-5);
    transition: border-color var(--app-transition-fast);
}

.console-card:hover {
    border-color: var(--app-accent);
}

.console-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--app-space-5);
    display: flex;
    align-items: center;
    gap: var(--app-space-3);
}

.console-card-title .icon {
    width: 28px;
    height: 28px;
    border-radius: var(--app-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--app-text-inverse);
}

/* Icon backgrounds - solid colors instead of gradients */
.console-card-title .icon.upload { background: var(--app-info); }
.console-card-title .icon.search { background: var(--app-accent); }
.console-card-title .icon.result { background: var(--app-success); }
.console-card-title .icon.dev { background: var(--app-warning); font-size: 11px; }

/* ----------------------------------------
   Upload Zone
   ---------------------------------------- */
.upload-zone {
    border: 2px dashed var(--app-border);
    border-radius: var(--app-radius-lg);
    padding: var(--app-space-10) var(--app-space-5);
    text-align: center;
    cursor: pointer;
    transition: all var(--app-transition-fast) var(--app-ease);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--app-accent);
    background: var(--app-accent-subtle);
}

.upload-zone .upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--app-space-4);
    border-radius: 50%;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--app-accent);
}

.upload-zone h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--app-space-2);
    color: var(--app-text);
}

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

.upload-zone .file-types {
    display: flex;
    justify-content: center;
    gap: var(--app-space-2);
    margin-top: var(--app-space-4);
}

.upload-zone .file-type {
    background: var(--app-surface-elevated);
    padding: var(--app-space-1) var(--app-space-3);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--app-text-secondary);
    font-weight: 500;
}

/* ----------------------------------------
   Form Elements
   ---------------------------------------- */
.console-form-group {
    margin-bottom: var(--app-space-5);
}

.console-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--app-text-secondary);
    margin-bottom: var(--app-space-2);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    background: var(--app-surface);
    border: 1.5px solid var(--app-border);
    border-radius: var(--app-radius-md);
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--app-text);
    font-family: inherit;
    transition: border-color var(--app-transition-fast), box-shadow var(--app-transition-fast);
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 var(--app-focus-ring-width) var(--app-focus-ring);
}

.input-wrapper input::placeholder {
    color: var(--app-text-placeholder);
}

.input-wrapper input:read-only {
    background: var(--app-surface-elevated);
    color: var(--app-text-secondary);
}

.input-row {
    display: flex;
    gap: var(--app-space-3);
}

.input-row .input-wrapper {
    flex: 1;
}

/* ----------------------------------------
   File Preview
   ---------------------------------------- */
.file-preview {
    display: none;
    align-items: center;
    gap: var(--app-space-3);
    padding: var(--app-space-4);
    background: var(--app-surface-elevated);
    border-radius: var(--app-radius-md);
    margin-bottom: var(--app-space-5);
}

.file-preview.show {
    display: flex;
}

.file-preview .file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--app-radius-sm);
    background: var(--app-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--app-text-inverse);
}

.file-preview .file-info {
    flex: 1;
    min-width: 0;
}

.file-preview .file-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--app-text);
}

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

.file-preview .remove-btn {
    background: none;
    border: none;
    color: var(--app-text-secondary);
    cursor: pointer;
    padding: var(--app-space-2);
    border-radius: 50%;
    transition: all var(--app-transition-fast);
}

.file-preview .remove-btn:hover {
    background: var(--app-error-bg);
    color: var(--app-error);
}

/* ----------------------------------------
   Progress Steps
   ---------------------------------------- */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--app-space-6);
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 60px;
    right: 60px;
    height: 2px;
    background: var(--app-border);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--app-space-3);
    position: relative;
    z-index: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--app-surface);
    border: 2px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--app-transition-fast) var(--app-ease);
}

.step-circle.pending { color: var(--app-text-placeholder); }

.step-circle.processing {
    border-color: var(--app-accent);
    color: var(--app-accent);
    animation: console-pulse 1.5s infinite;
}

.step-circle.completed {
    background: var(--app-success);
    border-color: var(--app-success);
    color: var(--app-text-inverse);
}

.step-circle.failed {
    background: var(--app-error);
    border-color: var(--app-error);
    color: var(--app-text-inverse);
}

@keyframes console-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0); }
}

.step-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--app-text-secondary);
    text-align: center;
}

.step-label.active { color: var(--app-text); }

/* ----------------------------------------
   Status Details
   ---------------------------------------- */
.status-details {
    background: var(--app-surface-elevated);
    border-radius: var(--app-radius-md);
    padding: var(--app-space-5);
    display: none;
}

.status-details.show { display: block; }

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--app-space-3) 0;
    border-bottom: 1px solid var(--app-border);
}

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

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

.status-value {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--app-text);
}

.status-value.success { color: var(--app-success); }
.status-value.warning { color: var(--app-warning); }
.status-value.error { color: var(--app-error); }
.status-value.info { color: var(--app-accent); }

.status-value code {
    background: var(--app-accent-subtle);
    padding: var(--app-space-1) var(--app-space-2);
    border-radius: var(--app-radius-xs);
    font-family: var(--app-font-mono);
    font-size: 0.85rem;
}

/* ----------------------------------------
   Progress Bar (for text extraction)
   ---------------------------------------- */
.extract-progress {
    margin-top: var(--app-space-3);
    display: none;
}

.extract-progress.show { display: block; }

.extract-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--app-border);
    border-radius: 3px;
    overflow: hidden;
}

.extract-progress-fill {
    height: 100%;
    background: var(--app-accent);
    border-radius: 3px;
    transition: width 0.5s var(--app-ease);
    width: 0%;
}

.extract-progress-text {
    font-size: 0.8rem;
    color: var(--app-text-secondary);
    margin-top: var(--app-space-2);
    text-align: right;
}

/* ----------------------------------------
   Result Card
   ---------------------------------------- */
.result-card {
    display: none;
    background: var(--app-success-bg);
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: var(--app-radius-lg);
    padding: var(--app-space-5);
}

.result-card.show { display: block; }

.result-header {
    display: flex;
    align-items: center;
    gap: var(--app-space-3);
    margin-bottom: var(--app-space-5);
}

.result-header .check-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--app-success);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-text-inverse);
    font-size: 16px;
}

.result-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--app-text);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--app-space-4);
}

.result-item {
    background: var(--app-surface);
    padding: var(--app-space-4);
    border-radius: var(--app-radius-md);
    border: 1px solid var(--app-border);
}

.result-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--app-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--app-space-1);
}

.result-item .value {
    font-weight: 600;
    word-break: break-all;
    color: var(--app-text);
}

/* ----------------------------------------
   Messages
   ---------------------------------------- */
.console-message {
    padding: var(--app-space-3) var(--app-space-4);
    border-radius: var(--app-radius-md);
    margin-bottom: var(--app-space-4);
    display: none;
    align-items: center;
    gap: var(--app-space-3);
    font-size: 0.875rem;
}

.console-message.show { display: flex; }

.console-message.success {
    background: var(--app-success-bg);
    color: #166534;
}

.console-message.error {
    background: var(--app-error-bg);
    color: #991b1b;
}

.console-message.info {
    background: #f0f9ff;
    color: #075985;
}

/* ----------------------------------------
   Dev Panel (ID List)
   ---------------------------------------- */
.dev-panel {
    background: var(--app-warning-bg);
    border-color: rgba(217, 119, 6, 0.3);
}

.dev-panel:hover {
    border-color: rgba(217, 119, 6, 0.5);
}

.dev-panel .console-card-title {
    color: var(--app-warning);
}

.dev-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--app-warning);
    background: rgba(217, 119, 6, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: var(--app-space-2);
}

.id-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.id-table th {
    text-align: left;
    padding: var(--app-space-2) var(--app-space-3);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
    border-bottom: 1px solid var(--app-border);
}

.id-table td {
    padding: var(--app-space-3);
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.id-table tr:last-child td { border-bottom: none; }

.id-table tr:hover td {
    background: var(--app-surface-elevated);
}

.id-link {
    color: var(--app-accent);
    font-family: var(--app-font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.id-link:hover { text-decoration: underline; }

.id-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.id-badge.completed {
    background: var(--app-success-bg);
    color: var(--app-success);
}

.id-badge.failed {
    background: var(--app-error-bg);
    color: var(--app-error);
}

.id-badge.pending,
.id-badge.uploading,
.id-badge.extracting,
.id-badge.publishing {
    background: rgba(8, 145, 178, 0.1);
    color: var(--app-info);
}

.id-badge.unknown {
    background: var(--app-surface-elevated);
    color: var(--app-text-muted);
}

.id-table-empty {
    text-align: center;
    padding: var(--app-space-6);
    color: var(--app-text-muted);
    font-size: 0.875rem;
}

/* ----------------------------------------
   Utility Classes
   ---------------------------------------- */
.hidden-file-input { display: none; }

/* ----------------------------------------
   Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
    .console-container {
        padding: var(--app-space-6) var(--app-space-4);
    }

    .console-card {
        padding: var(--app-space-5);
        border-radius: var(--app-radius-md);
    }

    .upload-zone {
        padding: var(--app-space-8) var(--app-space-4);
    }

    .input-row {
        flex-direction: column;
    }

    .progress-steps::before {
        left: 40px;
        right: 40px;
    }

    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .step-label {
        font-size: 0.75rem;
    }

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

@media (max-width: 480px) {
    .console-header h1 {
        font-size: 1.75rem;
    }

    .console-header p {
        font-size: 0.95rem;
    }

    .console-card-title {
        font-size: 1.1rem;
    }

    .progress-steps {
        gap: var(--app-space-2);
    }

    .step-label {
        font-size: 0.7rem;
    }
}
