/* Mediaform PDF Tools - Styles */

:root {
    --blue: #2563EB;
    --blue-dark: #1d4ed8;
    --yellow: #FBC02D;
    --yellow-dark: #f9a825;
    --text: #1a1a1a;
    --text-light: #666;
    --bg: #ffffff;
    --bg-light: #f8fafc;
    --radius: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Decorative blocks */
.decor {
    position: fixed;
    border-radius: var(--radius-lg);
    z-index: -1;
}

.decor.blue { background: var(--blue); }
.decor.yellow { background: var(--yellow); }

.decor-top-left {
    top: -40px;
    left: -40px;
    width: 200px;
    height: 80px;
}

.decor-top-right {
    top: 20px;
    right: -60px;
    width: 180px;
    height: 100px;
}

.decor-bottom-left {
    bottom: 20px;
    left: -60px;
    width: 150px;
    height: 120px;
}

.decor-bottom-right {
    bottom: -40px;
    right: -40px;
    width: 200px;
    height: 80px;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    height: 60px;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Privacy badge */
.privacy-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg-light);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 40px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.privacy-badge svg {
    color: var(--blue);
    flex-shrink: 0;
}

/* Tools grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 60px;
}

/* Centra l'ultimo elemento se è dispari (quinta card) */
.tools-grid .tool-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: calc(50% - 10px);
    justify-self: center;
}

.tool-card {
    background: var(--bg);
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    display: block;
}

.tool-card:hover {
    border-color: var(--blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

.tool-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.tool-icon.blue-bg { background: var(--blue); }
.tool-icon.yellow-bg { background: var(--yellow); }

.tool-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tool-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Footer */
footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ============================================
   TOOL PAGES STYLES
   ============================================ */

.tool-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.back-link:hover {
    background: #e2e8f0;
}

.tool-header h1 {
    font-size: 1.8rem;
    text-align: left;
    margin: 0;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-light);
    margin-bottom: 24px;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--blue);
    background: rgba(37, 99, 235, 0.05);
}

.drop-zone svg {
    color: var(--blue);
    margin-bottom: 16px;
}

.drop-zone p {
    color: var(--text-light);
    margin-bottom: 8px;
}

.drop-zone .hint {
    font-size: 0.85rem;
    color: #94a3b8;
}

.drop-zone input[type="file"] {
    display: none;
}

/* File info */
.file-info {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: none;
}

.file-info.visible {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-info .name {
    font-weight: 600;
    color: var(--text);
}

.file-info .pages {
    color: var(--text-light);
    font-size: 0.9rem;
}

.file-info .remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.file-info .remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Options panel */
.options-panel {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    display: none;
}

.options-panel.visible {
    display: block;
}

.options-panel h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text);
}

.option-group {
    margin-bottom: 16px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.option-group input[type="text"],
.option-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.option-group input[type="text"]:focus,
.option-group select:focus {
    outline: none;
    border-color: var(--blue);
}

.option-group .hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* Radio options */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input {
    accent-color: var(--blue);
}

/* Action button */
.action-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: none;
}

.action-btn.visible {
    display: block;
}

.action-btn:hover:not(:disabled) {
    background: var(--blue-dark);
}

.action-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.action-btn.yellow {
    background: var(--yellow);
    color: var(--text);
}

.action-btn.yellow:hover:not(:disabled) {
    background: var(--yellow-dark);
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
    display: none;
}

.progress-bar.visible {
    display: block;
}

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

/* File list for merge */
.file-list {
    list-style: none;
    margin-bottom: 24px;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: grab;
}

.file-list li:active {
    cursor: grabbing;
}

.file-list .drag-handle {
    color: #94a3b8;
}

.file-list .file-name {
    flex: 1;
    font-weight: 500;
}

.file-list .file-pages {
    color: var(--text-light);
    font-size: 0.85rem;
}

.file-list .remove-file {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px;
}

/* Results */
.results {
    margin-top: 24px;
    display: none;
}

.results.visible {
    display: block;
}

.results h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.download-list {
    list-style: none;
}

.download-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.download-list .download-btn {
    background: var(--blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
}

.download-list .download-btn:hover {
    background: var(--blue-dark);
}

.download-all-btn {
    margin-top: 16px;
    background: var(--yellow);
    color: var(--text);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.download-all-btn:hover {
    background: var(--yellow-dark);
}

/* Page selector for rotate */
.page-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.page-selector .page-item {
    aspect-ratio: 1;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.page-selector .page-item:hover {
    border-color: var(--blue);
}

.page-selector .page-item.selected {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}

/* Invoice preview */
.invoice-preview {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    display: none;
    font-size: 0.9rem;
}

.invoice-preview.visible {
    display: block;
}

.invoice-preview h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--blue);
    color: var(--text);
}

.invoice-section {
    margin-bottom: 20px;
}

.invoice-section:last-child {
    margin-bottom: 0;
}

.invoice-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.invoice-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.invoice-row .label {
    color: var(--text-light);
}

.invoice-row .value {
    font-weight: 500;
    text-align: right;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.85rem;
}

.invoice-table th {
    background: var(--bg-light);
    padding: 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.invoice-table td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.invoice-table .num {
    text-align: right;
}

.invoice-total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--blue);
    display: flex;
    justify-content: flex-end;
    gap: 40px;
}

.invoice-total .total-item {
    text-align: right;
}

.invoice-total .total-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.invoice-total .total-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

/* Password input */
.password-input-wrap {
    position: relative;
    display: flex;
    gap: 8px;
}

.password-input-wrap input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.password-input-wrap input:focus {
    outline: none;
    border-color: var(--blue);
}

.toggle-password {
    background: var(--bg-light);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 0 16px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.toggle-password:hover {
    background: #e2e8f0;
}

/* Checkbox options */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

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

/* GDPR Section */
.gdpr-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 40px;
    text-align: center;
}

.gdpr-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--blue) 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.gdpr-icon svg {
    color: white;
}

.gdpr-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.gdpr-section > p {
    max-width: 700px;
    margin: 0 auto 16px;
    color: var(--text-light);
    line-height: 1.7;
}

.gdpr-section > p:last-of-type {
    margin-bottom: 24px;
}

.gdpr-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
    text-align: left;
}

.gdpr-them,
.gdpr-us {
    padding: 20px;
    border-radius: var(--radius);
    background: white;
}

.gdpr-them {
    border: 1px solid #fecaca;
}

.gdpr-us {
    border: 1px solid #bbf7d0;
}

.gdpr-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.gdpr-badge.bad {
    background: #fef2f2;
    color: #dc2626;
}

.gdpr-badge.good {
    background: #f0fdf4;
    color: #16a34a;
}

.gdpr-them ul,
.gdpr-us ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gdpr-them li,
.gdpr-us li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.gdpr-them li:last-child,
.gdpr-us li:last-child {
    margin-bottom: 0;
}

.gdpr-them li::before {
    content: "✗";
    position: absolute;
    left: 0;
    color: #dc2626;
    font-weight: bold;
}

.gdpr-us li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #16a34a;
    font-weight: bold;
}

.gdpr-footer {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text) !important;
    margin-bottom: 0 !important;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 20px 16px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    /* Su mobile l'ultimo elemento occupa tutta la larghezza */
    .tools-grid .tool-card:last-child:nth-child(odd) {
        max-width: 100%;
        grid-column: auto;
    }
    
    .privacy-badge {
        flex-direction: column;
        text-align: center;
    }
    
    .decor {
        display: none;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .gdpr-section {
        padding: 24px;
    }
    
    .gdpr-comparison {
        grid-template-columns: 1fr;
    }
}
