* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3B82F6;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-gradient: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 50%, #FEF3C7 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: #1F2937;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login Screen - BEAUTIFUL VERSION */
.login-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
}

.login-header {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    animation: bounceIn 0.8s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.home-icon {
    width: 80px;
    height: 80px;
    color: var(--primary);
    filter: drop-shadow(0 10px 20px rgba(102, 126, 234, 0.3));
    transition: transform 0.3s ease;
}

.home-icon:hover {
    transform: scale(1.1) rotate(5deg);
}

.login-container h1 {
    font-size: 2.25rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: #1F2937;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: #6B7280;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

.family-list {
    background: white;
    border-radius: 1.25rem;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 10px 30px rgba(102, 126, 234, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideUp 0.6s ease-out;
}

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

.family-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border: 2px solid #F3F4F6;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #FAFBFC;
    position: relative;
    overflow: hidden;
}

.family-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.family-item:hover::before {
    transform: scaleY(1);
}

.family-item:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
    transform: translateX(5px);
}

.family-item span {
    font-weight: 600;
    color: #1F2937;
    font-size: 1.05rem;
    flex: 1;
}

.family-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.family-item:hover .family-dot {
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Password Screen - Beautiful Avatar */
#passwordStep {
    background: white;
    border-radius: 1.25rem;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 10px 30px rgba(102, 126, 234, 0.1);
    animation: slideUp 0.6s ease-out;
}

#selectedFamilyAvatar {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    margin: 0 auto 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 2rem !important;
    font-weight: bold !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2) !important;
    animation: avatarPop 0.6s ease-out !important;
}

@keyframes avatarPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

#selectedFamilyName {
    margin: 0 !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #1F2937 !important;
}

/* Property Selection Step */
#propertySelectionStep {
    background: white;
    border-radius: 1.25rem;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08), 0 10px 30px rgba(102, 126, 234, 0.1);
    animation: slideUp 0.6s ease-out;
}

.property-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.property-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 2px solid #F3F4F6;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #FAFBFC;
    position: relative;
    overflow: hidden;
}

.property-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 5px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.property-item:hover::before {
    transform: scaleY(1);
}

.property-item:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
    transform: translateX(8px);
}

.property-emoji {
    font-size: 3rem;
    line-height: 1;
    flex-shrink: 0;
}

.property-info {
    flex: 1;
}

.property-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1F2937;
}

.property-info p {
    margin: 0;
    color: #6B7280;
    font-size: 0.95rem;
}

.property-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6B7280;
    font-size: 0.9rem;
}

#selectedPropertyEmoji {
    animation: emojiFloat 0.8s ease-out;
}

@keyframes emojiFloat {
    0% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
}

.header-info h2 {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

.header-info p {
    font-size: 0.875rem;
    color: #6B7280;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    width: 28px;
    height: 28px;
    color: #6B7280;
}

.notification-bell svg {
    width: 100%;
    height: 100%;
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: bold;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2563EB 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 0.9rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: #6B7280;
}

.btn-icon:hover {
    background: #F3F4F6;
}

.btn-large {
    width: 100%;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

/* Main Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Statistics */
.stats-section {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    color: white;
    box-shadow: var(--shadow-lg);
}

.stats-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-title svg {
    width: 24px;
    height: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 0.75rem;
    padding: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.stat-card.winner {
    border-color: #FCD34D;
}

.stat-winner-badge {
    font-size: 0.625rem;
    font-weight: bold;
    color: #FCD34D;
    margin-bottom: 0.25rem;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stat-header span {
    font-weight: 500;
}

.stat-header svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.stat-priority {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    background: rgba(252, 211, 77, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Timeline */
.timeline-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #E5E7EB;
}

.timeline-title {
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-title svg {
    width: 20px;
    height: 20px;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #F9FAFB;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.timeline-item-content {
    flex: 1;
}

.timeline-family {
    font-weight: 500;
}

.timeline-dates {
    font-size: 0.875rem;
    color: #6B7280;
}

.timeline-days {
    font-size: 0.875rem;
    color: #6B7280;
    white-space: nowrap;
}

/* Notifications */
.notifications-section {
    background: #FEF3C7;
    border: 1px solid #FDE68A;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.notification-title {
    font-weight: 600;
    color: #78350F;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-title svg {
    width: 20px;
    height: 20px;
}

.notification-item {
    background: white;
    border: 1px solid #FDE68A;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.notification-text {
    font-weight: 500;
}

.notification-date {
    font-size: 0.875rem;
    color: #6B7280;
}

.notification-time {
    font-size: 0.75rem;
    color: #D97706;
    font-weight: 500;
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.notification-actions .btn {
    flex: 1;
}

/* Booking Form */
.booking-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #E5E7EB;
}

.booking-form {
    margin-top: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #E5E7EB;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #F9FAFB;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
    transform: translateY(-2px);
}

/* Calendar */
.calendar-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #E5E7EB;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.calendar-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.view-toggle {
    display: flex;
    background: #F3F4F6;
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle button.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

#calendarTitle {
    font-size: 1.25rem;
    font-weight: bold;
}

/* Year View */
.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.month-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 180px;
}

.month-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.month-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.month-bookings {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.month-booking {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: help;
    transition: all 0.2s;
}

.month-booking:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.booking-family {
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.booking-days {
    color: #6B7280;
    margin-left: 0.5rem;
    white-space: nowrap;
}

/* Month View */
.month-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    overflow: hidden;
}

.calendar-day-header {
    background: #F9FAFB;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    border-bottom: 1px solid #E5E7EB;
}

.calendar-day {
    min-height: 120px;
    padding: 0.5rem;
    border: 1px solid #E5E7EB;
    background: white;
}

.calendar-day.today {
    background: #EFF6FF;
    border-color: #BFDBFE;
}

.day-number {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.day-bookings {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.day-booking {
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: #1F2937;
    line-height: 1.3;
    min-height: 28px;
    display: block;
    cursor: help;
    transition: transform 0.2s, box-shadow 0.2s;
}

.day-booking:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .year-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   PWA PUSH NOTIFICATION STYLES
   =================================== */

.push-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

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

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

.push-notification-content {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-left: 4px solid #3B82F6;
}

.push-notification-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.push-notification-text {
    flex: 1;
}

.push-notification-title {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 0.25rem;
}

.push-notification-body {
    color: #6B7280;
    font-size: 0.875rem;
    line-height: 1.4;
}

.push-notification-close {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.push-notification-close:hover {
    color: #374151;
}

/* PWA Install Prompt */
#pwa-install-prompt {
    animation: slideInBottom 0.3s ease-out;
}

@keyframes slideInBottom {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* PWA Mode Safe Areas */
.pwa-mode {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .push-notification {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
    }
    
    .push-notification-content {
        padding: 0.875rem;
    }
    
    .push-notification-icon {
        width: 40px;
        height: 40px;
    }
}

/* ===================================
   MULTI-PROPERTY SWITCHER
   =================================== */

.property-switcher-container {
    margin-top: 0.25rem;
}

.property-switcher-btn {
    background: #F3F4F6;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.property-switcher-btn:hover {
    background: #E5E7EB;
}

.property-switcher-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    min-width: 300px;
    z-index: 1000;
    padding: 0.5rem;
}

.property-switcher-item {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.property-switcher-item:hover {
    background: #F3F4F6;
}

.property-switcher-item.active {
    background: #EEF2FF;
    border-left-color: #667eea;
}

.property-switcher-item span {
    display: block;
    font-weight: 600;
    color: #1F2937;
    font-size: 1rem;
}

.property-switcher-item small {
    display: block;
    color: #6B7280;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.property-switcher-item.active span {
    color: #667eea;
}

/* Mobile Property Switcher */
@media (max-width: 768px) {
    .property-switcher-menu {
        min-width: 280px;
    }
    
    .property-switcher-btn {
        font-size: 0.875rem;
        padding: 0.4rem 0.875rem;
    }
}
