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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #050d42;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

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

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

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.card h2 {
    color: #eeb121;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #eeb121;
    padding-bottom: 10px;
}

/* Upload Section */
.upload-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-input-group label {
    font-weight: 600;
    color: #555;
}

.file-input-group input[type="file"] {
    padding: 10px;
    border: 2px dashed #eeb121;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input-group input[type="file"]:hover {
    border-color: #f58e06;
    background: #f8f9ff;
}

.file-name {
    color: #888;
    font-size: 0.9em;
    font-style: italic;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #eeb121 0%, #f58e06 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #f58e0666;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Messages */
.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

/* Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

@media (max-width: 1200px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* PDF Viewer */
.pdf-viewer-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pdf-viewer-container h3 {
    color: #555;
    font-size: 1.3em;
}

#pdf-canvas-container {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: crosshair;
}

#pdf-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

#bbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#bbox-selector {
    position: absolute;
    border: 3px solid #eeb121;
    background: rgba(102, 126, 234, 0.2);
    display: none;
    pointer-events: none;
}

#bbox-selector.active {
    display: block;
}

.pdf-controls {
    display: flex;
    gap: 10px;
}

/* Config Params */
.config-params {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.config-params h3 {
    color: #555;
    font-size: 1.3em;
}

.param-group {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.param-group h4 {
    color: #eeb121;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.param-row {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.param-row label {
    font-weight: 500;
    color: #555;
}

.param-row input[type="number"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.param-row select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    grid-column: 2 / 4;
}

.param-row.checkbox {
    grid-template-columns: auto 1fr;
}

.param-row.checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.param-row.checkbox label {
    cursor: pointer;
}

.info-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.info-box p {
    margin-bottom: 8px;
    color: #555;
}

.info-box strong {
    color: #333;
}

/* Generate Section */
.generate-controls {
    text-align: center;
    margin-bottom: 20px;
}

#progress-container {
    margin-top: 30px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

#progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #eeb121 0%, #f58e06 100%);
    width: 0%;
    transition: width 0.3s;
}

#progress-text {
    text-align: center;
    color: #555;
    font-weight: 600;
}

/* Download Section */
.download-info {
    text-align: center;
    margin-bottom: 30px;
}

.download-info p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #555;
}

.download-info strong {
    color: #eeb121;
}

.reset-container {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    color: #eeb121;
    margin-bottom: 20px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

#preview-iframe {
    width: 100%;
    height: 600px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #eeb121;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
