@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

/* Material Icons */
.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

.tnr-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #1a1a1a;
    min-height: 100vh;
    color: #e0e0e0;
}

.tnr-page-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #2d2d2d;
    border-radius: 10px;
    border: 1px solid #404040;
}

.tnr-page-header h1 {
    color: #ffffff;
    margin-bottom: 10px;
}

.tnr-page-header p {
    color: #b0b0b0;
    font-size: 16px;
}

#tnr-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    min-height: 100vh;
}

.tnr-timer {
    background: #2d2d2d;
    color: white;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
    text-align: center;
    border: 1px solid #404040;
    position: sticky;
    top: 0;
    z-index: 1001;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.tnr-timer.clock-mode {
    background: #2d2d2d;
    border-color: #404040;
    min-height: 120px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    position: relative;
}

.tnr-timer.clock-mode .tnr-timer-column.center {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 0 auto !important;
}

.tnr-timer.clock-mode:hover {
    background: #3d3d3d;
}

.tnr-timer-progress-container {
    width: 100%;
    height: 8px;
    background: #1a1a1a;
    border-top: 1px solid #404040;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tnr-timer.clock-mode .tnr-timer-progress-container {
    display: none;
}

.tnr-timer-progress-bar {
    height: 100%;
    width: 100%;
    background: #00a32a;
    transform-origin: left;
    transform: scaleX(1);
    transition: transform 0.1s linear, background 0.5s ease;
}

.tnr-timer-display {
    font-size: 5em;
    font-weight: bold;
    margin: 0;
    font-family: "Courier New", monospace;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    border: none;
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    width: 100%;
    transition: color 0.5s ease, text-shadow 0.5s ease;
    cursor: pointer;
}

.tnr-timer-display:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Stili per gli elementi separati del timer */
.tnr-timer-sign,
.tnr-timer-minutes,
.tnr-timer-separator,
.tnr-timer-seconds {
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

.tnr-timer-dot,
.tnr-timer-centiseconds {
    opacity: 0.3;
    transition: color 0.5s ease, text-shadow 0.5s ease, opacity 0.3s ease;
}

.tnr-timer-controls {
    display: grid;
    grid-template-columns: 2fr 6fr 2fr;
    gap: 0;
    justify-content: center;
    align-items: center;
    margin: 0;
    width: 100%;
    transition: all 0.3s ease;
}

.tnr-timer.clock-mode .tnr-timer-controls {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
}

.tnr-timer.clock-mode .tnr-timer-column:first-child,
.tnr-timer.clock-mode .tnr-timer-column:last-child {
    display: none !important;
}

.tnr-timer.clock-mode .tnr-timer-column.center {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tnr-timer.clock-mode .tnr-timer-progress-container {
    display: none !important;
}

.tnr-timer.clock-mode .tnr-timer-display {
    display: flex !important;
    width: 100% !important;
    height: 120px !important;
    font-size: 5em !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    color: #00ff00 !important;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5) !important;
    text-align: center !important;
    margin: 0 auto !important;
}

.tnr-timer-column {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    height: 100%;
    justify-content: center;
}

.tnr-timer-column.center {
    justify-content: center;
}

.tnr-timer-adjust {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.tnr-timer-adjust button {
    width: 100%;
    height: 100%;
    padding: 0;
    font-size: 36px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    flex: 1;
}

.tnr-timer-main-buttons {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.tnr-timer-main-buttons .tnr-btn {
    width: 100%;
    height: 100%;
    font-size: 32px;
    font-weight: bold;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.tnr-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.tnr-btn * {
    pointer-events: auto;
    cursor: pointer;
}

.tnr-btn-primary {
    background: linear-gradient(135deg, #0073aa, #005a8b);
    color: white;
    border: 1px solid #005a8b;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

.tnr-btn-success {
    background: linear-gradient(135deg, #00a32a, #007a20);
    color: white;
    border: 1px solid #007a20;
    box-shadow: 0 2px 4px rgba(0, 163, 42, 0.3);
}

.tnr-btn-danger {
    background: linear-gradient(135deg, #d63638, #b02a2c);
    color: white;
    border: 1px solid #b02a2c;
    box-shadow: 0 2px 4px rgba(214, 54, 56, 0.3);
}

.tnr-btn-warning {
    background: linear-gradient(135deg, #dba617, #b8940f);
    color: white;
    border: 1px solid #b8940f;
    box-shadow: 0 2px 4px rgba(219, 166, 23, 0.3);
}

.tnr-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tnr-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: #404040 !important;
    color: #666 !important;
    border-color: #555 !important;
    box-shadow: none !important;
}

.tnr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.tnr-mode-selector {
    display: flex;
    gap: 10px;
    flex: 1;
}

.tnr-menu-btn {
    padding: 12px 16px;
    border: 2px solid #404040;
    background: #2d2d2d;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
}

.tnr-menu-btn:hover {
    background: #3d3d3d;
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tnr-menu-btn .material-icons {
    font-size: 24px;
}

.tnr-mode-btn {
    flex: 1;
    padding: 15px;
    border: 2px solid #404040;
    background: #2d2d2d;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    position: relative;
    overflow: hidden;
}

.tnr-mode-btn * {
    pointer-events: auto;
    cursor: pointer;
}

.tnr-mode-btn:hover {
    background: #3d3d3d;
    border-color: #555;
}

.tnr-mode-btn.active {
    background: linear-gradient(135deg, #0073aa, #005a8b);
    color: white;
    border-color: #0073aa;
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

.tnr-block {
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #2d2d2d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.tnr-block.dragging {
    opacity: 0.6;
    transform: scale(0.98);
}

.tnr-block.drop-target {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

.tnr-block:hover {
    border-color: #0073aa;
    box-shadow: 0 6px 12px rgba(0, 115, 170, 0.2);
}

.tnr-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #404040;
    gap: 15px;
}

.tnr-block-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 18px;
    flex: 1;
}

.tnr-block-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tnr-block-actions .tnr-btn {
    padding: 8px 12px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.tnr-block-actions .tnr-btn .material-icons {
    font-size: 20px;
}

.tnr-btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: 1px solid #5a6268;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.tnr-btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
    border-color: #495057;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.tnr-btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #404040 !important;
    color: #666 !important;
    border-color: #555 !important;
    box-shadow: none !important;
    transform: none !important;
}

.tnr-block-type {
    margin-bottom: 20px;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #404040;
}


.tnr-button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.tnr-button-group-inline {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #404040;
    background: #2d2d2d;
}

.tnr-btn-left {
    border-radius: 0 !important;
    border-right: 1px solid #404040 !important;
    border-left: none !important;
    border-top: none !important;
    border-bottom: none !important;
    flex: 1;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.tnr-btn-right {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
    flex: 1;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.tnr-btn-left.active {
    background: linear-gradient(135deg, #0073aa, #005a8b) !important;
    color: white !important;
    border-color: #0073aa !important;
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4) !important;
    transform: translateY(-1px) !important;
}

.tnr-btn-right.active {
    background: linear-gradient(135deg, #0073aa, #005a8b) !important;
    color: white !important;
    border-color: #0073aa !important;
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4) !important;
    transform: translateY(-1px) !important;
}

.tnr-type-btn {
    padding: 12px 18px;
    border: 2px solid #404040;
    background: #2d2d2d;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.tnr-type-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.tnr-type-btn:hover::before {
    left: 100%;
}

.tnr-type-btn:hover {
    background: #3d3d3d;
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tnr-type-btn.active {
    background: linear-gradient(135deg, #0073aa, #005a8b);
    color: white;
    border-color: #0073aa;
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
    transform: translateY(-1px);
    position: relative;
}


.tnr-block-properties {
    margin: 15px 0;
    padding: 15px 20px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #404040;
    display: none;
}

.tnr-block-properties.active {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.tnr-property-section {
    border-radius: 6px;
    padding: 12px 15px;
    border-left: 4px solid;
    background: rgba(0, 0, 0, 0.1);
}

.tnr-property-section.inquadratura {
    border-left-color: #00a32a;
    background: rgba(0, 163, 42, 0.05);
}

.tnr-property-section.grafica {
    border-left-color: #dba617;
    background: rgba(219, 166, 23, 0.05);
}

.tnr-property-section.autostrade {
    border-left-color: #d63638;
    background: rgba(214, 54, 56, 0.05);
}

.tnr-property-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    color: #ffffff;
}

.tnr-property-section.inquadratura .tnr-property-section-title {
    color: #00a32a;
}

.tnr-property-section.grafica .tnr-property-section-title {
    color: #dba617;
}

.tnr-property-section.autostrade .tnr-property-section-title {
    color: #d63638;
}

.tnr-property-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.tnr-property-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tnr-property-field label {
    font-size: 11px;
    font-weight: 600;
    color: #b0b0b0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tnr-property-field input,
.tnr-property-field select,
.tnr-property-field textarea {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #404040;
    border-radius: 4px;
    background: #2d2d2d;
    color: #e0e0e0;
    transition: all 0.3s ease;
}

.tnr-property-field input:focus,
.tnr-property-field select:focus,
.tnr-property-field textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
    background: #1a1a1a;
}

.tnr-property-field textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
}

.tnr-form-group {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}


.tnr-form-group input,
.tnr-form-group select,
.tnr-form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    border: 2px solid #404040;
    border-radius: 8px;
    font-size: 14px;
    background: #2d2d2d;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.tnr-form-group input:focus,
.tnr-form-group select:focus,
.tnr-form-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    background: #1a1a1a;
    transform: translateY(-1px);
}

.tnr-form-group input:hover,
.tnr-form-group select:hover,
.tnr-form-group textarea:hover {
    border-color: #555;
    background: #333;
}

.tnr-form-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    margin-top: 20px;
}

.tnr-form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.tnr-reader-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh; /* Fallback per browser che non supportano dvh */
    height: 100dvh; /* Dynamic viewport height per gestire le barre del browser */
    width: 100vw;
    background: #1a1a1a;
    z-index: 1000;
    flex-direction: column;
    overflow: hidden; /* Solo la modalità lettura ha overflow hidden */
}

.tnr-reader-view.active {
    display: flex;
}

.tnr-reader-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100vh - 200px); /* Fallback per browser che non supportano dvh */
    height: calc(100dvh - 200px); /* Altezza fissa: 100dvh - timer - frecce */
}

.tnr-reader-blocks-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    height: 100%;
}

.tnr-create-view {
    display: block;
    overflow: visible; /* Permette lo scroll nella modalità creazione */
    height: auto; /* Altezza automatica per permettere lo scroll */
}

#tnr-blocks-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

@media (min-width: 1400px) {
    #tnr-blocks-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 25px;
    }
}

.tnr-create-view.hidden {
    display: none;
}

.tnr-reader-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #404040;
}



.tnr-scroll-controls {
    display: flex;
    justify-content: center;
    gap: 0;
    width: 100%;
    position: sticky;
    bottom: 0;
    background: #1a1a1a;
    border-top: 2px solid #404040;
    z-index: 1001;
    flex-shrink: 0;
}

.tnr-scroll-controls .tnr-btn {
    width: 50%;
    padding: 20px;
    font-size: 28px;
    font-weight: bold;
    border-radius: 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tnr-scroll-controls .tnr-btn .material-icons {
    font-size: 32px;
}

.tnr-exit-button {
    width: 100%;
    padding: 20px;
    font-size: 28px;
    font-weight: bold;
    border-radius: 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #d63638, #b02a2c);
    color: white;
    border: 1px solid #b02a2c;
    box-shadow: 0 2px 4px rgba(214, 54, 56, 0.3);
    transition: all 0.3s ease;
}

.tnr-exit-button:hover {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 8px rgba(214, 54, 56, 0.4);
    transform: translateY(-2px);
}

.tnr-exit-button .material-icons {
    font-size: 32px;
    margin-right: 10px;
}

.tnr-pagination {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tnr-reader-block {
    background: #2d2d2d;
    border: 2px solid #0073aa;
    border-radius: 10px;
    margin: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    flex-shrink: 0;
}

.tnr-reader-block:hover {
    border-color: #00a32a;
    box-shadow: 0 6px 12px rgba(0, 115, 170, 0.2);
}

.tnr-reader-block.current {
    border-color: #00a32a;
    box-shadow: 0 6px 16px rgba(0, 163, 42, 0.4);
    transform: scale(1.02);
}

.tnr-reader-block.current .tnr-reader-block-text {
    background: rgba(0, 115, 170, 0.15);
    border-color: rgba(0, 115, 170, 0.4);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
    color: #ffffff;
    font-weight: 600;
}

.tnr-reader-block-number {
    font-size: 32px;
    font-weight: bold;
    color: #00a32a;
    text-align: left;
    margin-bottom: 20px;
    line-height: 1;
}

.tnr-reader-inquadratura {
    font-size: 16px;
    font-weight: 500;
    color: #b0b0b0;
    margin-bottom: 15px;
    text-align: left;
    background: rgba(0, 163, 42, 0.08);
    padding: 10px 12px;
    border-radius: 4px;
    border-left: 3px solid #00a32a;
    width: fit-content;
    display: inline-block;
}

.tnr-reader-block-text {
    font-size: var(--tnr-reader-font-size, 24px);
    line-height: 1.7;
    color: #ffffff;
    margin-bottom: 30px;
    text-align: left;
    padding: 20px 25px;
    background: rgba(0, 115, 170, 0.1);
    border-radius: 8px;
    font-weight: 500;
    border: 2px solid rgba(0, 115, 170, 0.2);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.tnr-reader-grafica {
    margin-bottom: 15px;
}

.tnr-reader-grafica-title {
    font-size: 14px;
    font-weight: 500;
    color: #dba617;
    text-align: left;
    margin-bottom: 8px;
    background: rgba(219, 166, 23, 0.08);
    padding: 8px 12px;
    border-radius: 3px;
    border-left: 3px solid #dba617;
    width: fit-content;
    display: inline-block;
}

.tnr-reader-grafica-list {
    text-align: left;
    font-size: 16px;
    color: #e0e0e0;
    padding: 0 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.tnr-reader-autostrade {
    margin-bottom: 15px;
}

.tnr-reader-autostrade-title {
    font-size: 14px;
    font-weight: 500;
    color: #d63638;
    text-align: left;
    margin-bottom: 8px;
    background: rgba(214, 54, 56, 0.08);
    padding: 8px 12px;
    border-radius: 3px;
    border-left: 3px solid #d63638;
    width: fit-content;
    display: inline-block;
}

.tnr-reader-autostrade-list {
    text-align: left;
    font-size: 16px;
    color: #e0e0e0;
    padding: 0 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.tnr-reader-autostrada {
    display: flex;
    margin: 0 6px 6px 0;
    padding: 6px 10px;
    background: rgba(214, 54, 56, 0.08);
    border-radius: 3px;
    border: 1px solid rgba(214, 54, 56, 0.2);
    font-size: 12px;
    color: #b0b0b0;
    flex-shrink: 0;
}

.tnr-reader-grafica-item {
    display: flex;
    margin: 0 6px 6px 0;
    padding: 6px 10px;
    background: rgba(219, 166, 23, 0.08);
    border-radius: 3px;
    border: 1px solid rgba(219, 166, 23, 0.2);
    font-size: 12px;
    color: #b0b0b0;
    flex-shrink: 0;
}

/* Menu Overlay */
.tnr-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tnr-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.tnr-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #2d2d2d;
    border-left: 1px solid #404040;
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.tnr-sidebar.active {
    right: 0;
}

.tnr-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.tnr-sidebar-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.tnr-close-btn {
    padding: 8px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.tnr-close-btn:hover {
    background: #404040;
    color: #ffffff;
}

.tnr-close-btn .material-icons {
    font-size: 24px;
}

.tnr-sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tnr-sheet-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: flex-start;
    margin-top: 10px;
}

.tnr-sheet-actions .tnr-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    min-width: 40px;
}

.tnr-sheet-actions .tnr-btn .material-icons {
    font-size: 20px;
    flex-shrink: 0;
}

.tnr-sheets-section h4 {
    color: #ffffff;
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tnr-sheet-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.tnr-sheet-item {
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.tnr-sheet-item:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    background: #2d2d2d;
}

.tnr-sheet-item h4 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 16px;
}

.tnr-sheet-item p {
    margin: 0;
    color: #b0b0b0;
    font-size: 12px;
    margin-bottom: 5px;
}

.tnr-sheet-item .tnr-btn {
    font-size: 18px;
    padding: 8px 12px;
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.tnr-add-block {
    font-size: 24px;
    padding: 12px 16px;
    min-width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Material Icons nei pulsanti */
.tnr-btn .material-icons {
    font-size: inherit;
    vertical-align: middle;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.tnr-timer-main-buttons .tnr-btn .material-icons {
    font-size: 32px;
}

.tnr-timer-adjust .tnr-btn .material-icons {
    font-size: 36px;
}

.tnr-scroll-controls .tnr-btn .material-icons {
    font-size: 24px;
}

.tnr-sheet-management .tnr-btn .material-icons {
    font-size: 20px;
}

.tnr-sheet-item .tnr-btn .material-icons {
    font-size: 18px;
}

.tnr-add-block .material-icons {
    font-size: 24px;
}

.tnr-mode-btn .material-icons {
    font-size: 24px;
}

.tnr-mode-btn:disabled,
.tnr-mode-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #1a1a1a;
    border-color: #333;
}

.tnr-mode-btn:disabled .material-icons,
.tnr-mode-btn.disabled .material-icons {
    opacity: 0.5;
}

/* Scrollbar personalizzata per dark mode */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Selezione testo */
::selection {
    background: #0073aa;
    color: white;
}

::-moz-selection {
    background: #0073aa;
    color: white;
}

/* Focus globale - disabilitato per evitare halo su tablet */
*:focus {
    outline: none;
    outline-offset: 0;
}

/* Disabilita effetti hover e ombreggiature sui dispositivi touch */
@media (hover: none) and (pointer: coarse) {
    .tnr-btn:hover {
        opacity: 1;
        box-shadow: none;
        transform: none;
    }
    
    .tnr-mode-btn:hover {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .tnr-block:hover {
        border-color: #404040;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }
    
    .tnr-reader-block:hover {
        border-color: #0073aa;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }
    
    .tnr-sheet-item:hover {
        border-color: #404040;
        box-shadow: none;
        background: #1a1a1a;
    }
    
    .tnr-type-btn:hover {
        background: #2d2d2d;
        border-color: #404040;
    }
}

@media (max-width: 768px) {
    #tnr-blocks-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tnr-btn-left,
    .tnr-btn-right {
        padding: 10px 12px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }
    
    .tnr-timer-controls {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }
    
    .tnr-timer-display {
        font-size: 3em;
        min-height: 80px;
    }
    
    .tnr-timer-main-buttons .tnr-btn {
        width: 100%;
        height: 100%;
        font-size: 24px;
        flex: 1;
        border-radius: 0;
    }
    
    .tnr-timer-adjust button {
        width: 100%;
        height: 100%;
        font-size: 28px;
        flex: 1;
        border-radius: 0;
    }
    
    .tnr-mode-selector {
        flex-direction: column;
    }
    
    .tnr-reader-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .tnr-block-properties.active {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .tnr-button-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .tnr-type-btn {
        min-height: 48px;
        font-size: 16px;
    }
    
    .tnr-form-group input,
    .tnr-form-group select,
    .tnr-form-group textarea {
        padding: 16px;
        font-size: 16px;
    }
    
    .tnr-block-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .tnr-block-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .tnr-block-actions .tnr-btn {
        min-width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .tnr-block-actions .tnr-btn .material-icons {
        font-size: 22px;
    }
    
    .tnr-scroll-controls .tnr-btn {
        min-height: 100px;
        font-size: 32px;
    }
    
    .tnr-scroll-controls .tnr-btn .material-icons {
        font-size: 36px;
    }
    
    .tnr-exit-button {
        min-height: 100px;
        font-size: 32px;
    }
    
    .tnr-exit-button .material-icons {
        font-size: 36px;
    }
    
    .tnr-reader-content {
        height: calc(100vh - 220px); /* Fallback per browser che non supportano dvh */
        height: calc(100dvh - 220px); /* Altezza fissa per mobile con frecce più alte */
    }
    
    .tnr-reader-block {
        margin: 15px;
    }
    
    .tnr-reader-block-header h3 {
        font-size: 24px;
    }
    
    .tnr-reader-block-text {
        font-size: 18px;
    }
    
    .tnr-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .tnr-sidebar.active {
        right: 0;
    }
    
    .tnr-sidebar-content {
        padding: 15px;
    }
    
    .tnr-sheet-actions .tnr-btn {
        padding: 16px;
        font-size: 18px;
    }
    
    .tnr-sheet-actions .tnr-btn .material-icons {
        font-size: 22px;
    }
    
    .tnr-menu-btn {
        min-width: 60px;
        height: 60px;
    }
    
    .tnr-menu-btn .material-icons {
        font-size: 28px;
    }
    
    .tnr-page-container {
        padding: 10px;
    }
}

/* Ottimizzazioni specifiche per mobile in portrait */
@media (orientation: portrait) and (max-width: 600px) {
    .tnr-timer-display {
        font-size: 2.6em;
        min-height: 72px;
    }

    .tnr-timer-progress-container {
        height: 6px;
    }

    .tnr-timer-main-buttons .tnr-btn {
        font-size: 20px;
        min-height: 56px;
    }

    .tnr-timer-adjust button {
        font-size: 24px;
        min-height: 56px;
    }

    .tnr-reader-content {
        height: calc(100vh - 180px);
        height: calc(100dvh - 180px);
    }

    .tnr-scroll-controls .tnr-btn {
        min-height: 80px;
        font-size: 26px;
        padding: 16px;
    }

    .tnr-scroll-controls .tnr-btn .material-icons,
    .tnr-exit-button .material-icons {
        font-size: 28px;
    }

    .tnr-exit-button {
        min-height: 80px;
        font-size: 26px;
        padding: 16px;
    }

    .tnr-reader-block {
        margin: 10px;
        padding: 14px;
        border-radius: 8px;
    }

    .tnr-reader-block-number {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .tnr-reader-inquadratura {
        font-size: 14px;
        margin-bottom: 10px;
        padding: 8px 10px;
    }

    .tnr-reader-block-text {
        font-size: 18px;
        line-height: 1.6;
        padding: 14px 16px;
        margin-bottom: 20px;
    }

    .tnr-reader-grafica-title,
    .tnr-reader-autostrade-title {
        font-size: 12px;
        padding: 6px 10px;
    }

    .tnr-reader-grafica-list,
    .tnr-reader-autostrade-list {
        font-size: 14px;
    }

    .tnr-reader-grafica-item,
    .tnr-reader-autostrada {
        font-size: 11px;
        padding: 5px 8px;
    }

    .tnr-menu-btn {
        min-width: 52px;
        height: 52px;
    }
}
