/**
 * UnPlotter - PDF Data Extractor
 * Copyright (c) 2025 Robert McDonald
 * Licensed under the MIT License
 * See LICENSE file in the project root for full license information.
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    /*padding: 20px;*/
}

header {
    text-align: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header a {
    display: inline-block;
    vertical-align: middle;
}

header h1 {
    color: #2c3e50;
}

.subtitle {
    color: #7f8c8d;
    font-size: 0.9em;
    padding-bottom: 10px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Viewer Section */
.viewer-section {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-info {
    color: #7f8c8d;
    font-size: 0.9em;
    flex-shrink: 0;
}

.file-controls, .nav-controls, .zoom-controls, .rotation-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 5px;
    background: #ecf0f1;
    flex-wrap: wrap;
}

.page-info {
    font-weight: 500;
}

#zoomLevel {
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

/* Content Wrapper with Side Panel */
.content-wrapper {
    flex: 1;
    display: flex;
    gap: 0;
    overflow: hidden;
    position: relative;
}

.canvas-container {
    flex: 1;
    text-align: center;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    padding: 20px;
    position: relative;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 1.2em;
    text-align: center;
}

.canvas-placeholder p {
    margin: 0;
}

#pdfCanvas {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: white;
    display: none;
}

#pdfCanvas.loaded {
    display: block;
}

/* Side Panel */
.side-panel {
    width: 30%;
    min-width: 300px;
    max-width: 50%;
    background: #f8f9fa;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    position: relative;
}

.resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: #ddd;
    cursor: ew-resize;
    transition: background 0.2s;
    z-index: 10;
}

.resize-handle:hover,
.resize-handle.dragging {
    background: #3498db;
}

/* Panel Selection Controls */
.panel-selection-controls {
    padding: 1rem;
    background: #e8f4f8;
    border-bottom: 2px solid #3498db;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.panel-selection-controls .btn {
    width: 100%;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    background: #3498db;
    color: white;
    min-height: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    overflow: visible;
    vertical-align: middle;
}

.btn i {
    font-size: 1em;
    padding-right: 5px;
}

.btn i.fa-github {
    font-size: 1.5em;
}

.paypalbtn{
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    background-color: #FFD140;
    color: #000000;
    font-family: "Helvetica Neue", Arial, sans-serif;
    min-height: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    overflow: visible;
    vertical-align: middle;
}

#zoomIn,
#zoomOut,
#rotateClockwiseBtn,
#rotateCounterClockwiseBtn {
    font-size: 1.5em;
}

.btn-primary {
    background: #3498db;
    color: white;
    font-size: 1em;
    padding: 10px 20px;
}

.btn-toggle {
    background: #27ae60;
}

.btn-toggle:hover {
    background: #229954;
}

.btn-toggle.active {
    background: #e67e22;
}

.btn-toggle.active:hover {
    background: #d35400;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn:hover {
    opacity: 0.8;
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn:disabled:hover {
    opacity: 1;
}

/* Labeling Section */
.labeling-section {
    padding: 1.5rem;
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
}

.labeling-section h3 {
    margin-top: 0;
    color: #856404;
    font-size: 1.1rem;
}

.labeling-instruction {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.label-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.label-input-group input[type="text"] {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #ffc107;
    border-radius: 4px;
    font-size: 0.9rem;
}

.label-input-group input[type="text"]:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

.label-input-group .btn {
    padding: 10px 20px;
    font-size: 1em;
    min-height: 40px;
}

.curve-browser {
    background: white;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 1rem;
}

.browser-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ffc107;
}

.curve-count {
    font-size: 0.85rem;
    color: #856404;
}

.curve-count strong {
    color: #ff9800;
    font-size: 1rem;
}

.curve-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
}

.curve-list .empty-message {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.curve-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.curve-list-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.curve-list-item.active {
    background: #fff3cd;
    border-color: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

.curve-info {
    flex: 1;
}

.curve-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.curve-details {
    padding-right: 10px;
    font-size: 0.75rem;
    color: #6c757d;
}

.curve-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 10px 20px;
    font-size: 0.9rem;
    min-width: auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-warning {
    background: #ff9800;
    color: white;
    padding: 10px 20px;
    font-size: 1em;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-danger {
    background: #dc3545;
    color: white;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-danger:hover {
    background: #c82333;
}

/* Calibration Section */
.calibration-section {
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.calibration-section h3 {
    margin-top: 0;
    color: #495057;
    font-size: 1.1rem;
}

.calibration-instruction {
    color: #6c757d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.calibration-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.axis-calibration h4 {
    margin: 0;
    color: #495057;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 1.5rem;
    text-align: center;
}

.calibration-points {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.point-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.point-input input[type="number"] {
    flex: 1;
    min-width: 0;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
}

.point-input input[type="number"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-calibrate {
    min-width: auto;
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-calibrate:hover {
    background: #138496;
}

.btn-calibrate.active-calibration {
    background: #ff6b6b;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-indicator {
    font-size: 1.2rem;
    color: #999;
    font-weight: bold;
    flex-shrink: 0;
}

.calibration-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.calibration-actions .btn {
    padding: 10px 20px;
    font-size: 1em;
    min-height: 40px;
}

.calibration-status {
    font-size: 0.9rem;
    font-weight: 500;
}

.calibration-status .status-text {
    color: #6c757d;
}

.calibration-status .status-text.success {
    color: #28a745;
    font-weight: 600;
}

/* Export Section */
.export-section {
    padding: 1.5rem;
    background: #e8f5e9;
    border-bottom: 2px solid #4CAF50;
}

.export-section h3 {
    margin-top: 0;
    color: #2e7d32;
    font-size: 1.1rem;
}

.export-instruction {
    color: #558b2f;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-export {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background 0.2s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.export-preview {
    background: white;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    padding: 0.75rem;
}

.export-preview h4 {
    margin: 0 0 0.5rem 0;
    color: #2e7d32;
    font-size: 0.9rem;
}

.export-preview pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #333;
    overflow-x: auto;
    max-height: 150px;
    overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
    }

    .side-panel {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid #ddd;
        height: 40vh;
    }

    .resize-handle {
        display: none;
    }
}
