/* Output Page - Encoding Worksheet (STORY-036) */

/* Page header layout is handled by css/header.css */

/* Output Container */
.output-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* Output Section */
.output-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.section-header {
    /* Layout controlled by css/header.css, typography by semantic h2 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border);
}

.section-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.count-badge {
    padding: var(--space-xs) var(--space-md);
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.btn-secondary {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
}

/* Output Tables */
.output-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.output-table thead {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

.output-table th {
    text-align: left;
    padding: var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.output-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.output-table tbody tr:hover {
    background: var(--surface);
}

.output-table tbody tr:last-child {
    border-bottom: none;
}

.output-table td {
    padding: var(--space-md);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    vertical-align: middle;
}

/* Copyable cells */
.output-table td[data-copy] {
    cursor: pointer;
    user-select: text;
    position: relative;
    transition: all var(--transition-fast);
}

.output-table td[data-copy]:hover {
    background: rgba(37, 99, 235, 0.05);
}

.output-table td[data-copy].selected {
    background: rgba(37, 99, 235, 0.15);
}

.output-table td[data-copy].copied {
    background: var(--success-color);
    color: white;
}

/* Column widths */
.col-checkbox {
    width: 50px;
    text-align: left;
}

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

.col-title {
    min-width: 200px;
    max-width: 300px;
}

.col-justification {
    min-width: 250px;
    max-width: 400px;
}

.col-date {
    min-width: 100px;
    white-space: nowrap;
}

.col-reference {
    min-width: 120px;
}

.col-vendor {
    min-width: 150px;
}

.col-vat-country {
    min-width: 80px;
    white-space: nowrap;
}

.col-vat {
    min-width: 120px;
}

.col-amount {
    min-width: 100px;
    font-weight: 600;
    color: var(--success-color);
    white-space: nowrap;
}

.col-vat-rate {
    min-width: 80px;
    white-space: nowrap;
}

/* Encoded Row Styles (checked checkbox) */
.output-table tbody tr.encoded {
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.02);
}

.output-table tbody tr.encoded td {
    text-decoration: line-through;
    color: var(--text-muted);
}

.output-table tbody tr.encoded td.col-amount {
    color: var(--text-muted);
}

.output-table tbody tr.encoded:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state p {
    font-size: var(--font-size-lg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .output-container {
        padding: var(--space-md);
    }

    .output-section {
        padding: var(--space-md);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .section-actions {
        width: 100%;
        justify-content: space-between;
    }

    .output-table {
        font-size: var(--font-size-sm);
    }

    .output-table th,
    .output-table td {
        padding: var(--space-sm);
    }
}

/* Print Styles */
@media print {
    .top-nav,
    .footer,
    .section-actions {
        display: none;
    }

    .output-table tbody tr.encoded {
        display: none;
    }

    .output-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* STORY-2.4: Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-body p {
    margin: 0 0 var(--space-md) 0;
}

.modal-body strong {
    color: var(--text-primary);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

.modal-footer button {
    min-width: 100px;
}

/* STORY-2.4: Toast Styles */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    min-height: 48px;
    max-height: 100px;
    word-break: break-word;
}

.toast-enter {
    animation: toastSlideIn 0.3s ease-out;
}

.toast-exit {
    animation: toastSlideOut 0.3s ease-out;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    font-size: var(--font-size-md);
    line-height: 1;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Toast type colors */
.toast-success {
    border-left-color: #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info {
    border-left-color: var(--primary-color);
}

.toast-info .toast-icon {
    color: var(--primary-color);
}

/* STORY-2.4: Celebration Animation Styles */
.celebration {
    text-align: center;
    padding: var(--space-lg) 0;
}

.celebration h3 {
    margin: 0 0 var(--space-md) 0;
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.celebration p {
    font-size: var(--font-size-md);
    margin: var(--space-sm) 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.celebration p:nth-child(2) {
    animation-delay: 0.1s;
}

.celebration p:nth-child(3) {
    animation-delay: 0.2s;
}

.celebration p:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Control buttons for archive/complete */
.output-controls-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
}

.output-controls {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}
