/*
Theme Name:   Top Tennis PWA (Child)
Template:     hello-elementor
*/

/* ==========================================================
   1. FIX HEADER E BARRA DI AMMINISTRAZIONE (I NUOVI FIX)
   ========================================================== */

/* Nasconde il link di accessibilità "Vai al contenuto" rimasto orfano del tema */
a.skip-link {
    display: none !important;
}


/* Nasconde in modo forzato l'header nativo di Elementor e il titolo pagina */
header.site-header,
.elementor-location-header,
h1.entry-title,
.page-header {
    display: none !important;
}

/* Su tutti i dispositivi, la barra PWA resta in basso. Il padding-bottom del body (già presente) evita sovrapposizioni. */

/* Su mobile (< 768px) la barra PWA resta SEMPRE in basso, quindi non serve padding-top extra per lei nel corpo */
@media screen and (max-width: 767px) {
    .admin-bar body {
        padding-top: 0 !important;
        /* WP gestisce già il suo margin-top sulla html tag o body */
    }
}

/* ==========================================================
   2. STILE SCHERMATA DI LOGIN E REGISTRAZIONE PWA
   ========================================================== */
.toptennis-auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a url('https://images.unsplash.com/photo-1595435934249-5df7ed86e1c0?q=80&w=1000&auto=format&fit=crop') center/cover no-repeat;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 10000;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.toptennis-auth-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.85) 100%);
    z-index: 1;
    pointer-events: none;
}

.toptennis-auth-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    margin: 40px auto;
    padding: 0 20px;
    color: white;
    box-sizing: border-box;
}

.auth-logo-header {
    text-align: center;
    margin-bottom: 25px;
}

.auth-logo-circle {
    width: 85px;
    height: 85px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    padding: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
}

.auth-logo-circle img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.auth-logo-header h2 {
    color: white;
    margin: 0 0 5px;
    font-weight: 700;
    font-size: 24px;
}

.auth-logo-header p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* Auth Boxes */
.auth-form-box {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    color: #333;
}

.auth-form-box label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.auth-form-box input[type="text"],
.auth-form-box input[type="email"],
.auth-form-box input[type="tel"],
.auth-form-box input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #2d3748;
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.auth-form-box input::placeholder {
    color: #a0aec0;
}

.auth-form-box input:focus {
    outline: none;
    background: white;
    border-color: #0F9D58;
    box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.1);
}

/* Password Toggle Visibility Fix */
.login-password {
    position: relative;
    width: 100%;
}

.login-password input[type="password"],
.login-password input[type="text"] {
    padding-right: 45px !important;
}

.pwd-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #64748b;
    z-index: 10;
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    margin-top: -10px; /* Correzione fine basata sull'altezza dell'input */
}

.pwd-toggle:hover {
    color: #0F9D58;
}

.pwd-toggle:hover {
    color: #0F9D58;
}

/* Specifico per il Modulo Registrazione */
.auth-register-type-selection {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 10px;
}

.auth-type-label {
    flex: 1;
    margin: 0 !important;
}

.auth-type-label input {
    display: none;
}

.auth-type-label span {
    display: block;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
}

.auth-type-label input:checked+span {
    background: white;
    color: #0F9D58;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.auth-register-header-small {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.auth-register-header-small h3 {
    margin: 0 0 5px;
    font-size: 18px;
    color: #1e293b;
    font-weight: 750;
}

.auth-register-header-small p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.tt-form-row {
    margin-bottom: 5px;
}

.tt-phone-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
}

.tt-phone-prefix {
    padding: 0 15px;
    font-size: 14px;
    color: #64748b;
    border-right: 1px solid #e2e8f0;
    white-space: nowrap;
}

.tt-phone-input-wrapper input {
    margin-bottom: 0 !important;
    border: none !important;
    background: transparent !important;
}

.tt-calc-link {
    font-size: 13px;
    color: #b7791f;
    text-decoration: none;
    font-weight: 600;
}

.tt-calc-link:hover {
    text-decoration: underline;
}

input.tt-auth-submit {
    width: 100%;
    background-color: #0F9D58;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

input.tt-auth-submit:active {
    transform: scale(0.98);
    background-color: #0c8046;
}

.auth-links-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    font-size: 13px;
}

.auth-forgot-pwd {
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
}

.auth-signup-text {
    color: #94a3b8;
    margin: 0;
}

.auth-signup-text a {
    color: #0F9D58;
    text-decoration: none;
    font-weight: 700;
    margin-left: 5px;
}

/* ==========================================================
   2.1. APP HEADER E FIX (MODIFICATO PER FIGMA: SFONDO BIANCO)
   ========================================================== */
.tt-app-header {
    background: #ffffff;
    color: #2D3748;
    padding: 15px 0;
    padding-top: max(15px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

.tt-app-header.tt-header-bg-admin {
    background-color: #f0f7ff;
}

.tt-app-header.tt-header-bg-manager {
    background-color: #f0fdf4;
}

.tt-app-header.tt-header-bg-customer {
    background-color: #ffffff;
}

.tt-app-header .tt-role-chip {
    vertical-align: middle;
    margin-left: 8px;
}

.tt-app-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.tt-app-header-left,
.tt-app-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tt-app-header-greeting {
    text-decoration: none;
    display: block;
}

.tt-app-header-greeting h3 {
    margin: 0 0 2px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
}

.tt-app-header-greeting p {
    margin: 0;
    font-size: 12px;
    color: #718096;
}

/* Widget Credito in Header */
.tt-header-credit-btn,
.tt-header-notif-btn {
    text-decoration: none !important;
    transition: opacity 0.2s;
}

.tt-header-credit-btn:hover,
.tt-header-notif-btn:hover {
    opacity: 0.8;
}

.tt-header-credit {
    display: flex;
    align-items: center;
    background: #f7fafc;
    padding: 6px 12px;
    border-radius: 50px;
    border: 1px solid #edf2f7;
    gap: 8px;
}

.tt-header-balance {
    font-size: 14px;
    font-weight: 700;
    color: #0F9D58;
}

.tt-header-recharge {
    width: 20px;
    height: 20px;
    background: #0F9D58;
    color: white !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.tt-app-header-notif,
.tt-app-header-logout {
    position: relative;
    width: 38px;
    height: 38px;
    background: #f7fafc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #edf2f7;
}

.tt-app-header-notif .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #4a5568;
}

.tt-app-header-logout .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #e74c3c;
}

.tt-notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: none;
    /* Hidden by default */
}

.tt-notif-dot.tt-notif-dot-active {
    display: block;
    animation: tt-pulse-red 2s infinite;
}

@keyframes tt-pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* Card Improvements */
.tt-card-title {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}

.tt-card-title .tt-btn-pwa,
.tt-card-title .tt-session-header-right,
.tt-card-title>a:last-child {
    margin-left: auto;
}

.tt-card-title .tt-btn-pwa {
    font-size: 13px;
    padding: 6px 15px;
    background: #0F9D58;
    color: white !important;
    text-decoration: none !important;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(15, 157, 88, 0.2);
    transition: all 0.2s ease;
}

.tt-card-title .tt-btn-pwa:hover {
    background: #0c8046;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(15, 157, 88, 0.3);
}

.tt-card-title .tt-btn-pwa .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ==========================================================
   3. STILE NAVIGAZIONE INFERIORE (MOBILE APP BAR)
   ========================================================== */
.pwa-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    /* Softer, larger shadow per Figma */
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 70px;
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom);
    font-family: 'Inter', -apple-system, sans-serif;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.pwa-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #A0AEC0;
    /* Slate 400 for inactive */
    font-size: 12px;
    font-weight: 500;
    transition: color 0.3s ease;
    width: 100%;
}

.pwa-bottom-nav .nav-item .dashicons {
    font-size: 26px;
    margin-bottom: 4px;
    height: 26px;
    transition: transform 0.2s ease;
}

.pwa-bottom-nav .nav-item:active .dashicons {
    transform: scale(0.9);
}

.pwa-bottom-nav .nav-item.active {
    color: #0F9D58;
    /* Figma Green */
}

body {
    padding-bottom: 80px;
    /* Spazio extra per la nav bar in basso */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #F7FAFC !important;
    /* Sfondo grigio chiarissimo tipo Figma */
}

/* Fix globale per evitare che la barra PWA copra il contenuto Elementor */
#content,
.elementor-section-wrap,
.tt-home-container {
    padding-bottom: 80px !important;
}

/* Fix per la barra nera di WordPress: su Desktop la barra in alto deve scalare */
@media screen and (min-width: 768px) {
    .admin-bar .tt-app-header {
        top: 32px !important;
    }
}

/* ==========================================================
   4. OTTIMIZZAZIONI MOBILE (HEADER COMPATTO)
   ========================================================== */
@media screen and (max-width: 767px) {

    /* Nascondi elementi ridondanti su mobile */
    .tt-app-header .tt-role-chip,
    .tt-app-header-greeting p,
    .tt-header-credit-btn {
        display: none !important;
    }

    /* Regola il padding e il font dell'header per compattezza */
    .tt-app-header {
        padding: 10px 0 !important;
        padding-top: max(10px, env(safe-area-inset-top)) !important;
    }

    .tt-app-header-greeting h3 {
        font-size: 20px !important;
        margin: 0 !important;
    }
}