/* Updated for deployment */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background-color: #000;
    color: #fff;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* Rotation class for portrait mode */
body.rotated {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -50vh;
    margin-top: -50vw;
}

html, body {
    width: 100%;
    height: 100%;
}

#slideshow-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#poster-display {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000;
    transition: opacity 1s ease-in-out;
}

/* Layout orizzontale: poster a sinistra */
body:not(.rotated) #poster-display {
    background-position: left center;
    background-size: auto 100%;
    padding-right: 50px;
}

#poster-display.fade-out {
    opacity: 0;
}

#poster-display.fade-in {
    opacity: 1;
}

#movie-info {
    position: absolute;
    bottom: 40px;
    left: 40px;
    right: 40px;
    padding: 30px;
    background: transparent;
    border-radius: 10px;
    opacity: 0;
    animation: slideUp 1s ease-out 0.5s forwards;
}

/* Layout orizzontale: info a destra */
body:not(.rotated) #movie-info {
    left: 40%;
    right: 40px;
    bottom: 40px;
    top: 40px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Nascondi scrollbar ma mantieni scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: rgba(0, 0, 0, 0.85);
    padding: 40px;
    margin-left: 20px;
    border-left: 3px solid #E5A00D;
}

.movie-info::-webkit-scrollbar {
    display: none;
}

/* Sfumatura solo in modalità rotata (verticale) */
body.rotated #movie-info {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%);
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.info-main h1 {
    margin: 0;
}

.info-main p {
    margin: 10px 0 0 0;
}

.ratings-section {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.rating-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(229, 160, 13, 0.15);
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid #E5A00D;
}

.rating-icon {
    font-size: 1.5em;
}

.rating-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #FFCC00;
}

.rating-label {
    font-size: 0.9em;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-details {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.detail-section h3 {
    font-size: 1.3em;
    color: #E5A00D;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.detail-section p {
    margin: 0;
    line-height: 1.6;
    font-size: 1.1em;
}

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

/* People sections - ridotte per ottimizzare spazio */
.people-list {
    display: block;
    margin-bottom: 10px;
}

/* Cast section usa flex normale */
#cast-section .people-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Director section con layout inline per permettere biografia estesa */
#director-section .people-list {
    display: block;
}

#director-section .person-item {
    display: inline-block;
    vertical-align: top;
}

/* Director Biography - occupa spazio rimanente a destra */
.director-bio {
    flex: 1;
    margin-top: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.75em;
    line-height: 1.4;
    color: #ddd;
}

.person-item {
    text-align: center;
    width: 70px; /* Ridotto da 80px */
}

.person-avatar {
    width: 70px; /* Ridotto da 80px */
    height: 70px;
    border-radius: 50%;
    background-color: #282828;
    background-size: cover;
    background-position: center;
    border: 3px solid #E5A00D;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(229, 160, 13, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: #E5A00D;
    font-weight: bold;
}

.person-avatar.no-image {
    background: linear-gradient(135deg, #282828 0%, #1F1F1F 100%);
}

.person-name {
    font-size: 0.85em;
    color: #ccc;
    line-height: 1.3;
    max-width: 100px;
    word-wrap: break-word;
}

.technical-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-badge {
    background: rgba(229, 160, 13, 0.2);
    border: 2px solid #E5A00D;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    color: #FFCC00;
    display: inline-block;
}

/* Nascondi dettagli in modalità verticale */
body.rotated .info-details {
    display: none;
}

body.rotated .info-grid {
    gap: 10px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#movie-title {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
}

/* NOW PLAYING Banner - Full width strip */
.now-playing-badge {
    display: block;
    background: linear-gradient(135deg, #E5A00D 0%, #FFCC00 100%);
    color: #000;
    padding: 15px 30px;
    margin: 0 0 20px 0;
    font-size: 0.4em;
    font-weight: bold;
    text-align: center;
    text-shadow: none;
    box-shadow: 0 4px 20px rgba(229, 160, 13, 0.6);
    animation: pulse-glow 2s ease-in-out infinite;
    letter-spacing: 3px;
    border-radius: 8px;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(229, 160, 13, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 6px 30px rgba(229, 160, 13, 0.9);
        transform: scale(1.02);
    }
}

#movie-year {
    font-size: 1.5em;
    color: #ccc;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}

#loading, #error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 2em;
    padding: 40px;
    background: rgba(0,0,0,0.8);
    border-radius: 15px;
}

#error button {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 0.7em;
    background: #E5A00D;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: bold;
}

#error button:hover {
    background: #FFCC00;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #282828;
    padding: 40px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #E5A00D;
    font-size: 2em;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #3d3d3d;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    color: #999;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s;
}

.tab-button:hover {
    color: #fff;
    background: rgba(229, 160, 13, 0.1);
}

.tab-button.active {
    color: #E5A00D;
    border-bottom-color: #E5A00D;
    background: rgba(229, 160, 13, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #fff;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #3d3d3d;
    border-radius: 5px;
    background-color: #1F1F1F;
    color: #fff;
    font-size: 1em;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #E5A00D;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.85em;
}

.form-group small a {
    color: #E5A00D;
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

.form-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.form-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #3d3d3d;
}

.form-divider span {
    position: relative;
    background: #282828;
    padding: 0 15px;
    color: #999;
    font-size: 0.9em;
    font-weight: bold;
}

.form-section {
    margin: 30px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid #3d3d3d;
}

.form-section h3 {
    margin: 0 0 15px 0;
    color: #E5A00D;
    font-size: 1.1em;
}

.form-section h4 {
    margin: 20px 0 10px 0;
    color: #FFCC00;
    font-size: 1em;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-item span {
    font-size: 0.95em;
}

.form-group.checkbox-group {
    margin-bottom: 25px;
}

.form-group.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.form-group.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
    width: 20px;
    height: 20px;
}

#config-form button {
    width: 100%;
    padding: 15px;
    background: #E5A00D;
    color: #000;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#config-form button:hover {
    background: #FFCC00;
}

#settings-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    opacity: 0.5;
}

#settings-button:hover {
    opacity: 1;
    background: rgba(229, 160, 13, 0.9);
    transform: scale(1.1);
}

/* Loading Animation */
#loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 15px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* New Movie Notification */
.new-movie-notification {
    position: fixed;
    top: 100px;
    right: 40px;
    background: linear-gradient(135deg, #E5A00D 0%, #FFCC00 100%);
    color: #000;
    padding: 20px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(229, 160, 13, 0.5);
    z-index: 1001;
    animation: slideInRight 0.5s ease-out;
}

.new-movie-notification.fade-out {
    animation: slideOutRight 0.5s ease-in;
}

.notification-icon {
    font-size: 1.5em;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Filmography Section */
.filmography-section {
    margin: 15px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    display: none;
}

.filmography-section.visible {
    display: block;
}

.filmography-section h4 {
    margin: 0 0 12px 0;
    color: #E5A00D;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filmography-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
}

/* Poster più piccoli quando ci sono più di 14 film (oltre 2 righe) */
.filmography-grid.small-posters {
    grid-template-columns: repeat(14, 1fr);
    gap: 8px;
}

.filmography-grid.small-posters .filmography-title {
    font-size: 0.7em;
}

.filmography-grid.small-posters .filmography-year {
    font-size: 0.65em;
}

/* Rimosso scrollbar hiding - non serve più */

.filmography-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.filmography-item:hover {
    transform: scale(1.05);
}

.filmography-poster {
    width: 100%;
    aspect-ratio: 2/3;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 5px;
    background-color: #2a2a2a;
}

.filmography-poster.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3a3a3a, #2a2a2a);
    color: #666;
    font-size: 2em;
    font-weight: bold;
}

.filmography-title {
    font-size: 0.85em;
    color: #ccc;
    line-height: 1.3;
    max-height: 3.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.filmography-year {
    font-size: 0.75em;
    color: #999;
    margin-top: 3px;
}

/* Director Biography - occupa spazio rimanente a destra */
.director-bio {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.75em;
    line-height: 1.4;
    color: #ddd;
}

.director-bio-title {
    color: #E5A00D;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    #movie-title {
        font-size: 2em;
    }
    
    #movie-year {
        font-size: 1.2em;
    }
    
    #movie-info {
        bottom: 20px;
        left: 20px;
        right: 20px;
        padding: 20px;
    }
    
    .modal-content {
        padding: 20px;
    }
}

.info-section {
    margin-bottom: 20px; /* Ridotto da 30px */
}

.info-section h3 {
    margin: 0 0 10px 0; /* Ridotto da 15px */
    color: #E5A00D;
    font-size: 1.1em; /* Ridotto da 1.3em */
}
