@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6419be;
    /* GROUPE IMA Violet */
    --primary-dark: #500fa0;
    --primary-light: rgba(100, 25, 190, 0.05);
    --secondary: #f59b14;
    --secondary-light: rgba(245, 155, 20, 0.1);
    --gris-ardoise: #283c50;
    --background: #ffffff;
    /* Clean white page background */
    --surface: #ffffff;
    --card-bg: #f8fafc;
    /* Light grey for the cards */
    --card-border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Planning 3-Column Grid */
.planning-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.planning-row-3col {
    display: grid;
    grid-template-columns: 32% 48% 20%;
    align-items: center;
    gap: 5px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.planning-row-3col:last-child {
    border-bottom: none;
}

.planning-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.planning-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-all;
}

.pdf-icon-big {
    font-size: 2.25rem;
    color: #ef4444; /* Standard PDF Red */
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

.pdf-icon-big:active {
    transform: scale(0.9);
    opacity: 0.8;
}

.pdf-placeholder {
    color: #e2e8f0;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--background);
    /* Soft grey for the overall container background */
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Phase Guidance Components */
.phase-header {
    background: transparent;
    padding: 0.5rem 1.25rem 0.25rem 1.25rem;
    /* Minimized spacing */
    border-bottom: none;
    margin-bottom: 0.25rem;
}

.phase-title {
    display: none;
    /* User requested removal */
}

.phase-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.guided-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border);
    /* Subtle elegant border */
    box-shadow: none;
}

.input-group-guided {
    margin-bottom: 1.5rem;
}

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

.input-icon-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.input-icon-label i {
    color: var(--primary);
    font-size: 0.9rem;
}

.form-control-guided {
    border: 1px solid var(--border);
    /* Lighter standard border */
    border-radius: var(--radius-md);
    padding: 0.825rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.form-control-guided:focus {
    background-color: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-light);
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9) !important;
    /* Clean light background */
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
    backdrop-filter: blur(4px) !important;
    /* Subtle blur */
}

#loading-overlay.active {
    display: flex !important;
}

.spinner-modern {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    /* Violet */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1.25rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    letter-spacing: 0.02rem;
}

/* Mobile Container */
.mobile-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--surface);
    min-height: 100vh;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.app-header {
    padding: 0.75rem 1.25rem;
    background: var(--background);
    /* Match the page background */
    color: var(--gris-ardoise);
    border-bottom: 1px solid var(--card-border);
    /* Lighter border for header */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.app-title {
    font-weight: 800;
    font-size: 1.25rem;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.app-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-header .btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    z-index: 10;
    /* Ensure buttons are above the decoration */
}

/* Forms & Inputs */
.content-area {
    padding: 0 1.25rem 110px 1.25rem;
    /* Increased bottom padding to prevent cutoff by sticky footer */
    flex: 1;
}

.form-label {
    font-weight: 700;
    color: var(--gris-ardoise);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s;
    background-color: white;
    color: var(--text-main);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

/* Buttons */
.btn-primary-custom {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(100, 25, 190, 0.2);
}

.btn-primary-custom:hover,
.btn-primary-custom:focus {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(100, 25, 190, 0.3);
    color: white;
}

.btn-secondary-custom {
    background-color: var(--secondary);
    color: var(--gris-ardoise);
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-xl {
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* Cards */
.info-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.875rem;
    margin-bottom: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    overflow-wrap: break-word;
}

.info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.info-value {
    font-weight: 700;
    color: var(--gris-ardoise);
    font-size: 0.9rem;
    overflow-wrap: break-word;
}

/* List Items */
.custom-list-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.custom-list-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

/* Stepper Component */
.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0 1rem 0;
    /* Reduced padding */
    position: relative;
    max-width: 320px;
    margin: 0 auto;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 31px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border);
    z-index: 1;
}

.step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.step-label {
    margin-top: 0.75rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.step-item.active .step-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 5px var(--primary-light);
}

.step-item.active .step-label {
    color: var(--primary);
}

.step-item.completed .step-circle {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.step-item.completed .step-label {
    color: #059669;
}

/* Specific button for Photo Upload */
.btn-photo-upload {
    padding: 2rem 1.5rem;
    background: #f8fafc;
    border: 2px dashed var(--border);
    color: var(--primary);
    border-radius: var(--radius-lg);
    font-weight: 700;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
    display: block;
}

.btn-photo-upload:active {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: scale(0.98);
}

.btn-outline-custom {
    border: 1px solid var(--border);
    background: white;
    color: var(--gris-ardoise);
    border-radius: var(--radius-md);
    padding: 0.625rem 1.25rem;
    font-weight: 700;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-outline-custom:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Section Titles */
.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--gris-ardoise);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-icon {
    color: var(--primary);
    background: var(--primary-light);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1rem;
}

/* Sticky Wizard Footer */
.wizard-footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.85); /* Semi-transparent */
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    padding: 1.25rem 1.5rem 1.75rem 1.5rem;
    box-shadow: 0 -15px 35px rgba(0, 0, 0, 0.08); /* More prominent shadow */
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    border-top: 1px solid rgba(0, 0, 0, 0.05); /* Softer border */
}

.wizard-footer .btn {
    border-radius: 14px;
    font-weight: 700;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
}

.wizard-footer .btn-primary, 
.wizard-footer form {
    flex: 2;
}

.wizard-footer form .btn-primary {
    width: 100%;
    flex: 1;
}

.wizard-footer .btn-light {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid #e2e8f0;
    flex: 1; /* Secondary action is narrower */
}

.wizard-footer .btn:active {
    transform: scale(0.96);
}

/* Gallery & Upload */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 2rem;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
    border: 1px solid var(--border);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 1.5rem;
}

.status-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Attesa Visita / Draft - Fase Iniziale (Azzurro/Indaco per contrasto) */
.status-planning {
    background: #eff6ff;
    color: #1e40af;
    border-color: #dbeafe;
}

/* In Attesa Approval - Fase di Transizione */
.status-pending {
    background: #fffbeb;
    color: #d97706;
    border-color: #fef3c7;
}

/* Da Rivedere / Rejected - Fase Critica */
.status-revision {
    background: #fff1f2;
    color: #e11d48;
    border-color: #ffe4e6;
}

/* Validato - Fase Finale */
.status-validated {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #dcfce7;
}

.badge-draft {
    background: #eff6ff;
    color: #1e40af;
}

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

/* Navbar Backoffice Overrides */
.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.025em;
}

.card {
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Reminder UI Enhancements */
.reminder-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border) !important;
}

.reminder-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-md) !important;
}

.reminder-icon-bg {
    width: 42px;
    height: 42px;
    background: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.extra-small {
    font-size: 0.7rem;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

#addReminderModal .modal-content {
    background: #fdfdfd;
}

#addReminderModal .form-control {
    background: #fff;
    border: 1px solid #eef2f6;
}

#addReminderModal .form-control:focus {
    background: #fff;
    border-color: var(--primary);
}

/* Premium User Identity Components */
.user-pill-mobile {
    display: flex;
    align-items: center;
    background: rgba(100, 25, 190, 0.05);
    border: 1px solid rgba(100, 25, 190, 0.1);
    border-radius: 50px;
    padding: 0.25rem 0.25rem 0.25rem 0.5rem;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.user-pill-mobile:active {
    background: rgba(100, 25, 190, 0.1);
    transform: scale(0.98);
}

.user-avatar-small {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.65rem;
}

.user-pill-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-right: 0.25rem;
}

.user-pill-logout {
    background: white;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.user-pill-logout:hover {
    background: #fef2f2;
}

/* Backoffice Account Sidebar Section */
.sidebar-account-section {
    margin-top: auto;
    margin-bottom: 1.5rem;
    margin-left: 1rem;
    margin-right: 1rem;
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

/* V3 UI Refinements */
.btn-soft-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-soft-danger:hover {
    background-color: #EF4444;
    color: white;
    transform: scale(1.05);
}

.user-card-desktop {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 15px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}
.user-card-desktop:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.account-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
}

.account-info {
    overflow: hidden;
}

.account-name {
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-role {
    color: #9CA3AF;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.btn-signout-premium {
    width: 100%;
    border: none;
    padding: 0.625rem;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-signout-premium:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* V5 UI Refinements */
.action-btn-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255,255,255,0.85);
    color: var(--primary);
    border: none;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}
.action-btn-circle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-color: white;
    color: var(--primary);
}
.action-btn-circle i {
    font-size: 1.05rem;
}

.mobile-user-row {
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(0,0,0,0.03);
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mobile-user-row i {
    color: var(--primary);
    opacity: 0.7;
}

/* Status Badges */
.badge-status {
    font-weight: 700 !important;
    padding: 0.4em 0.8em !important;
    border-radius: 8px !important;
    text-transform: uppercase !important;
    font-size: 0.65rem !important;
    letter-spacing: 0.05em !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none !important;
}

.badge-submitted {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
}

.badge-waiting {
    background-color: #fef3c7 !important;
    color: #92400e !important;
}

.badge-draft {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

.badge-rejected {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
}