/* src/styles/pdf-toc-wizard.css */

.toc-wizard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.toc-wizard-modal {
    background: #1e1e2e;
    color: #e0e0e0;
    border-radius: 12px;
    width: 90vw;
    max-width: 800px;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    overflow: hidden;
}

.toc-wizard-header {
    padding: 20px 24px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252536;
}

.toc-wizard-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.toc-wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.toc-wizard-footer {
    padding: 16px 24px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #252536;
}

/* Page Selection Grid */
.toc-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.toc-page-card {
    background: #2a2a3b;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    aspect-ratio: 1 / 1.414;
    display: flex;
    flex-direction: column;
}

.toc-page-card:hover {
    border-color: #5c5c8a;
    transform: translateY(-2px);
}

.toc-page-card.selected {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.toc-page-canvas-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.toc-page-canvas-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.toc-page-label {
    padding: 8px;
    text-align: center;
    font-size: 0.85rem;
    background: #2a2a3b;
    color: #ccc;
    border-top: 1px solid #333;
}

.toc-page-card.selected .toc-page-label {
    background: #4CAF50;
    color: #fff;
    border-top-color: #4CAF50;
    font-weight: 600;
}

.toc-checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4CAF50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toc-page-card.selected .toc-checkmark {
    opacity: 1;
    transform: scale(1);
}

/* Loading State */
.toc-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.toc-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #4CAF50;
    border-radius: 50%;
    animation: toc-spin 1s linear infinite;
    margin-bottom: 24px;
}

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

/* Verification Tree */
.toc-tree-container {
    background: #2a2a3b;
    border-radius: 8px;
    border: 1px solid #333;
    overflow-x: auto;
}

.toc-tree-table {
    width: 100%;
    border-collapse: collapse;
}

.toc-tree-table th,
.toc-tree-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #333;
    text-align: left;
}

.toc-tree-table th {
    background: #1e1e2e;
    font-weight: 600;
    font-size: 0.85rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.toc-input {
    background: #1e1e2e;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.toc-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.toc-select {
    background: #1e1e2e;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
}

.toc-btn-icon {
    background: transparent;
    border: none;
    color: #ff5252;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px;
}

.toc-btn-icon:hover {
    opacity: 1;
}

.toc-add-btn-row td {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.02);
}

.toc-btn-link {
    background: transparent;
    border: none;
    color: #4CAF50;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toc-btn-link:hover {
    text-decoration: underline;
}

/* Buttons */
.toc-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.toc-btn-secondary {
    background: transparent;
    color: #aaa;
}

.toc-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.toc-btn-primary {
    background: #4CAF50;
    color: white;
}

.toc-btn-primary:hover {
    background: #45a049;
}

.toc-btn-primary:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* Utilities */
.toc-level-1 .toc-title-cell { padding-left: 16px; }
.toc-level-2 .toc-title-cell { padding-left: 32px; }
.toc-level-3 .toc-title-cell { padding-left: 48px; }

.toc-help-text {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 16px;
}
