/* Reset e base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000000;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Safe area per iOS - rimosso per evitare interferenze con fullscreen */

/* Screen management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    z-index: 100;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Animazioni rimosse per evitare interferenze con fullscreen */

/* Lock Screen */
#lockScreen {
    background: url('../img/ios-back.png') no-repeat center center;
    background-size: cover;
    background-color: #000000;
    color: white;
    z-index: 1000;
}

.lock-container {
    text-align: center;
    padding: 2rem;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.time-display {
    margin-bottom: 4rem;
}

#currentTime {
    font-size: 6rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -2px;
}

#currentDate {
    font-size: 1.2rem;
    opacity: 0.8;
    font-weight: 400;
}

.fingerprint-to-unlock {
    margin: 3rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#fingerprintContainer {
    position: relative;
    transform: scale(1.25);
    cursor: pointer;
}

#fingerprintContainer * {
    position: absolute;
    top: 0;
    left: -25px;
}

#fingerprintText {
    color: white;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 6rem;
    text-align: center;
    opacity: 0.8;
}

/* Fingerprint SVG Styles */
#Path-1,
#Path-2,
#Path-3,
#Path-4,
#Path-5 {
    stroke-dasharray: 200;
    stroke-dashoffset: 0;
}

.animate-path {
    animation: 0.8s fingerprint_animation ease-in forwards;
}

.animate-path-delay {
    animation: 0.8s fingerprint_animation ease-in forwards;
    animation-delay: 0.1s;
}

.animate-text {
    animation: 0.5s fadeout linear forwards;
}

#check {
    animation-delay: 0.3s;
}

.animate-check {
    animation: 0.5s check_animation linear forwards;
}

#Oval {
    stroke-dasharray: 200px;
    stroke-dashoffset: 200;
    opacity: 0;
    transform: rotate(-75deg);
    transform-origin: 30px 30px;
}

.animate-oval {
    animation: 0.5s circle_animation 0.2s ease-in forwards;
}

/* Animations */
@keyframes fingerprint_animation {
    50% {
        stroke-dashoffset: -100;
    }
    60% {
        stroke-opacity: 0;
    }
    100% {
        stroke-dashoffset: -200;
        stroke-opacity: 0;
    }
}

@keyframes fadeout {
    60% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes circle_animation {
    60% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        stroke-dasharray: 400px;
        transform: rotate(40deg);
    }
}

@keyframes check_animation {
    0% {
        stroke-dasharray: 126;
        stroke-dashoffset: 126;
    }
    100% {
        stroke-dasharray: 45;
        stroke-dashoffset: 94;
    }
}

.lock-footer {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.emergency-info {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Call Screens */
#incomingCall, #inCall {
    background: url('../img/ios-back.png') no-repeat center center;
    background-size: cover;
    background-color: #000000;
    color: white;
    z-index: 1000;
}

.call-container {
    position: relative;
    text-align: center;
    padding: 2rem;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.caller-info {
    margin-top: 4rem;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.caller-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.caller-avatar img,
.caller-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.caller-name {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
}

.caller-subtitle {
    font-size: 1rem;
    opacity: 0.7;
    font-weight: 400;
    margin-bottom: 1rem;
}

.call-timer {
    font-size: 1.5rem;
    opacity: 0.9;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.call-messages {
    margin-top: 1rem;
    text-align: center;
}

.call-message {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.3s ease;
}

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

/* VU Meter */
.vu-meter-container {
    margin: 2rem 0;
}

.vu-meter {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 4px;
    height: 60px;
    margin-bottom: 0.5rem;
}

.vu-bar {
    width: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: background-color 0.1s ease;
}

.vu-bar.active {
    background: #4CAF50;
}

.vu-label {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Call Actions */
.call-actions {
    position: absolute;
    bottom: 6rem;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    width: 100%;
    padding: 0 2rem;
}

.action-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.action-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.call-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    position: relative;
}

.action-button img {
    width: 60px;
    height: 60px;
    transition: all 0.2s ease;
    border-radius: 50%;
    background: none;
    padding: 0;
}

.call-button img {
    width: 90px;
    height: 90px;
    transition: all 0.2s ease;
    border-radius: 50%;
    padding: 12px;
}

/* Stili specifici per i pulsanti Accept e Decline */
.call-button.accept img {
    background-color: #4CAF50;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.call-button.decline img {
    background-color: #f44336;
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.action-button span, .call-button span {
    color: white;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.action-button span {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.call-button span {
    margin-top: 1rem;
}

.action-button:hover img, .call-button:hover img {
    transform: scale(1.05);
}

.action-button:active img, .call-button:active img {
    transform: scale(0.95);
}

/* Effetti touch per mobile */
@media (hover: none) and (pointer: coarse) {
    .action-button:active img, .call-button:active img {
        transform: scale(0.9);
        transition: transform 0.1s ease;
    }
    
    .action-button:active, .call-button:active {
        transform: scale(0.95);
    }
}

/* Animazione per il bottone Accept */
.call-button.accept img {
    animation: acceptPulse 2s ease-in-out infinite;
    border-radius: 50%;
}

@keyframes acceptPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: toastSlideIn 0.3s ease;
}

.toast.error {
    background: rgba(244, 67, 54, 0.9);
}

.toast.success {
    background: rgba(76, 175, 80, 0.9);
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .lock-container, .call-container {
        padding: 1rem;
    }
    
    #currentTime {
        font-size: 6rem;
        font-weight: 600;
    }
    
    .caller-avatar {
        width: 140px;
        height: 140px;
    }
    
    .caller-name {
        font-size: 2.5rem;
    }
    
    .call-actions {
        gap: 2.5rem;
        bottom: 5rem;
    }
    
    .action-row {
        max-width: 350px;
    }
    
    .action-button img {
        width: 60px;
        height: 60px;
        padding: 15px;
    }
    
    .call-button img {
        width: 90px;
        height: 90px;
        padding: 12px;
    }
    
    .action-button span, .call-button span {
        font-size: 0.8rem;
        margin-top: 0.1rem;
    }
}

/* Design specifico per iPhone */
@media (max-width: 414px) {
    .call-actions {
        bottom: 4rem;
        gap: 2rem;
    }
    
    .action-row {
        max-width: 300px;
    }
    
    .action-button img {
        width: 70px;
        height: 70px;
        padding: 12px;
    }
    
    .call-button img {
        width: 90px;
        height: 90px;
        padding: 12px;
    }
    
    .caller-name {
        font-size: 2.5rem;
        margin-bottom: 0.3rem;
    }
    
    .caller-subtitle {
        font-size: 0.9rem;
    }
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .lock-container, .call-container {
        padding: 0.5rem;
    }
    
    .time-display {
        margin-bottom: 2rem;
    }
    
    #currentTime {
        font-size: 2.5rem;
    }
    
    .caller-info {
        margin-bottom: 1.5rem;
    }
    
    .caller-avatar {
        width: 100px;
        height: 100px;
    }
}

/* Animazioni */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.caller-avatar.pulse {
    animation: pulse 2s infinite;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Feedback Screen */
#feedbackScreen {
    background: url('../img/ios-back.png') no-repeat center center;
    background-size: cover;
    background-color: #000000;
    color: white;
    z-index: 1000;
}

.feedback-container {
    text-align: center;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.feedback-header {
    margin-bottom: 3rem;
}

.feedback-header h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.feedback-header p {
    font-size: 1rem;
    opacity: 0.7;
    font-weight: 400;
}

.feedback-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.star {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 50px;
    height: 50px;
    transition: all 0.2s ease;
}

.star svg {
    width: 100%;
    height: 100%;
    stroke: rgba(255, 255, 255, 0.5);
    fill: transparent;
    transition: all 0.2s ease;
}

.star:hover svg,
.star.active svg {
    stroke: #FFD700;
    fill: #FFD700;
    transform: scale(1.1);
}

.star:active {
    transform: scale(0.95);
}

.feedback-message {
    width: 100%;
}

.feedback-message textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    resize: none;
    backdrop-filter: blur(10px);
}

.feedback-message textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.feedback-message textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.feedback-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin-top: 1rem;
}

.feedback-button {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.feedback-button.submit {
    background: #4CAF50;
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.feedback-button.submit:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.feedback-button.submit:active {
    transform: translateY(0);
}

.feedback-button.skip {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.feedback-button.skip:hover {
    background: rgba(255, 255, 255, 0.15);
}

.feedback-button.skip:active {
    transform: scale(0.98);
}

/* Responsive per feedback screen */
@media (max-width: 480px) {
    .feedback-container {
        padding: 1.5rem;
    }
    
    .feedback-header h2 {
        font-size: 1.5rem;
    }
    
    .star {
        width: 40px;
        height: 40px;
    }
    
    .star-rating {
        gap: 0.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states per accessibilità */
.call-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.slide-handle:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.feedback-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.star:focus {
    outline: 2px solid rgba(255, 215, 0, 0.8);
    outline-offset: 2px;
    border-radius: 50%;
}
