/* PDF Tools specific styles - extends main style.css */
/* Following the-monospace-web design principles */

/* Back navigation styling */
.back-nav {
    max-width: calc(min(80ch, round(down, 100%, 1ch)));
    margin: 0 auto calc(var(--line-height)) auto;
    padding: 0 2ch;
}

.back-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    font-size: 0.9em;
}

.back-nav a:hover {
    text-decoration: underline;
    text-decoration-thickness: var(--border-thickness);
}

/* Tool descriptions */
.tool-description {
    margin: calc(var(--line-height) * 2) 0;
    border-left: calc(var(--border-thickness) * 2) solid var(--text-color-alt);
    padding-left: 2ch;
    color: var(--text-color-alt);
    font-weight: var(--font-weight-medium);
}

/* File inputs */
.file-input-container {
    position: relative;
    margin-bottom: var(--line-height);
}

.file-input-container input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-label {
    display: inline-block;
    background: none;
    border: var(--border-thickness) solid var(--text-color);
    color: var(--text-color);
    padding: calc(var(--line-height) / 2 - var(--border-thickness)) calc(2ch - var(--border-thickness));
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    height: calc(var(--line-height) * 2);
    line-height: normal;
}

.file-label:hover {
    background: var(--background-color-alt);
}

/* File lists and info */
.file-list, .file-info {
    margin: var(--line-height) 0;
    border: var(--border-thickness) solid var(--text-color);
    padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
    background-color: var(--background-color);
    min-height: calc(var(--line-height) * 3);
}

.file-list:empty::before, .file-info:empty::before {
    content: "Nessun file selezionato";
    color: var(--text-color-alt);
    font-style: italic;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--line-height) / 2) 0;
    border-bottom: 1px solid var(--text-color-alt);
    gap: 1ch;
}

.file-item:last-child {
    border-bottom: none;
}

.file-content {
    display: flex;
    align-items: center;
    gap: 1ch;
    flex: 1;
}

.file-preview {
    width: 8ch;
    height: calc(var(--line-height) * 4);
    border: 1px solid var(--text-color-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--text-color-alt);
    color: var(--background-color);
    font-size: 0.8em;
    text-align: center;
    flex-shrink: 0;
    font-weight: var(--font-weight-medium);
}

.file-preview canvas {
    max-width: 100%;
    max-height: 100%;
    border: none;
}

.file-name {
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family);
}

.file-size {
    color: var(--text-color-alt);
    font-size: 0.9em;
    font-weight: var(--font-weight-medium);
}

.remove-file {
    background: none;
    border: var(--border-thickness) solid var(--text-color-alt);
    color: var(--text-color-alt);
    cursor: pointer;
    padding: 0.2em 0.5em;
    font-size: 0.8em;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
}

.remove-file:hover {
    background-color: var(--text-color-alt);
    color: var(--background-color);
}

/* Split options */
.split-options {
    margin: calc(var(--line-height) * 2) 0;
}

.split-options label {
    display: block;
    margin-bottom: var(--line-height);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
}

.split-options input {
    width: calc(round(down, 100%, 1ch));
    border: var(--border-thickness) solid var(--text-color);
    padding: calc(var(--line-height) / 2 - var(--border-thickness)) calc(1ch - var(--border-thickness));
    background: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: inherit;
    font-weight: var(--font-weight-normal);
    height: calc(var(--line-height) * 2);
    line-height: normal;
}

.split-options input:focus {
    --border-thickness: 3px;
    outline: none;
}

.split-options input::placeholder {
    color: var(--text-color-alt);
    opacity: 1;
}

/* Action controls */
.action-controls {
    display: flex;
    align-items: center;
    gap: 2ch;
    margin-top: calc(var(--line-height) * 2);
    flex-wrap: wrap;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: var(--border-thickness) solid var(--text-color);
    color: var(--text-color);
    padding: calc(var(--line-height) / 2 - var(--border-thickness)) calc(3ch - var(--border-thickness));
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    height: calc(var(--line-height) * 2);
    line-height: normal;
}

.tool-btn:hover:not(:disabled) {
    background: var(--background-color-alt);
}

.tool-btn:active:not(:disabled) {
    transform: translate(2px, 2px);
}

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

/* Progress indicators */
.inline-progress {
    display: flex;
    align-items: center;
    gap: 1ch;
    font-size: 0.9em;
    color: var(--text-color-alt);
    font-weight: var(--font-weight-medium);
}

.progress-bar-small {
    width: 12ch;
    height: calc(var(--line-height) / 2);
    background-color: var(--background-color);
    border: 1px solid var(--text-color-alt);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--text-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Download button */
.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--text-color) !important;
    color: var(--background-color) !important;
    border: var(--border-thickness) solid var(--text-color) !important;
    padding: calc(var(--line-height) / 2 - var(--border-thickness)) calc(3ch - var(--border-thickness));
    text-decoration: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    height: calc(var(--line-height) * 2);
    line-height: normal;
}

.download-btn:hover {
    background-color: var(--background-color) !important;
    color: var(--text-color) !important;
    border-color: var(--text-color) !important;
}

.download-btn:active {
    transform: translate(2px, 2px);
}

/* Force theme colors on dynamically created elements */
html.dark-mode .download-btn {
    background-color: var(--text-color) !important;
    color: var(--background-color) !important;
    border-color: var(--text-color) !important;
}

html.dark-mode .download-btn:hover {
    background-color: var(--background-color) !important;
    color: var(--text-color) !important;
}

/* Utility classes */
.hidden {
    display: none;
}

/* Responsive design */
@media screen and (max-width: 600px) {
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: calc(var(--line-height) / 2);
        padding: var(--line-height) 0;
    }
    
    .file-content {
        width: 100%;
    }
    
    .file-preview {
        width: 6ch;
        height: calc(var(--line-height) * 3);
    }
    
    .action-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--line-height);
    }
    
    .tool-btn, .download-btn {
        width: 100%;
        justify-content: center;
    }
}