/* Main Styles for Piogino Meetup App + FAVORITES + ICS DOWNLOAD - ENHANCED */

/* CSS Custom Properties (Variables) */
:root {
    --primary-color: #6366f1;
    --primary-hover: #5b5bf6;
    --secondary-color: #6b7280;
    --secondary-hover: #5b6270;
    --success-color: #10b981;
    --success-hover: #059669;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --favorite-color: #eab308; /* Favorite/star color */
    --favorite-hover: #ca8a04; /* Favorite hover color */
    --download-color: #3b82f6; /* NEW: ICS download button color */
    --download-hover: #2563eb; /* NEW: ICS download button hover color */
    
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    
    --border-color: #d1d5db;
    --border-focus: var(--primary-color);
    
    --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 -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Calendar Styles - UPDATED: Stretched width with minimal gaps */
.calendar-day {
    height: 28px; /* Fixed height */
    width: 100%; /* Full width of grid cell */
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    position: relative;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 1px; /* Minimal margin for very small gaps */
}

.calendar-day:hover {
    transform: scale(1.05); /* Slightly reduced scale to prevent overlap */
    border-color: #4f46e5;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-day.available {
    background-color: #22c55e;
    color: white;
    border-color: #16a34a;
}

.calendar-day.checking {
    background-color: #f59e0b;
    color: white;
    border-color: #d97706;
}

.calendar-day.unavailable {
    background-color: #ef4444;
    color: white;
    border-color: #dc2626;
}

.calendar-day.neutral {
    background-color: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.calendar-day.other-month {
    opacity: 0.4;
    cursor: default;
    background-color: #f8fafc;
    color: #cbd5e1;
}

.calendar-day.other-month:hover {
    transform: none;
    border-color: transparent;
    box-shadow: none;
}

.calendar-day.today {
    border: 2px solid #4f46e5 !important;
    font-weight: bold;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.calendar-day.has-comment::after {
    content: '💬';
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 8px;
    z-index: 5;
}

/* UPDATED: Calendar grid container with minimal gaps */
#calendarGrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px; /* Minimal gap between cells */
    padding: 2px; /* Small padding around the grid */
    background: #e5e7eb; /* Light background to show minimal gaps */
}

/* Calendar responsive adjustments */
@media (max-width: 640px) {
    .calendar-day {
        height: 24px; /* Slightly smaller on mobile */
        font-size: 0.7rem;
        margin: 0.5px; /* Even smaller margin on mobile */
    }
    
    .calendar-day.has-comment::after {
        font-size: 7px;
        top: 0px;
        right: 0px;
    }
    
    #calendarGrid {
        gap: 1px; /* Even smaller gap on mobile */
        padding: 1px;
    }
}

/* Button Styles */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-xl);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-xl);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-xl);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-success:hover {
    background: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Favorite/Star Button Styles */
.btn-favorite {
    background: var(--favorite-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-favorite:hover {
    background: var(--favorite-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(234, 179, 8, 0.3);
}

.btn-favorite-outline {
    background: transparent;
    color: var(--favorite-color);
    border: 1px solid var(--favorite-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-favorite-outline:hover {
    background: var(--favorite-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(234, 179, 8, 0.3);
}

/* NEW: ICS Download Button Styles */
.btn-download {
    background: var(--download-color);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-right: 0.25rem;
}

.btn-download:hover {
    background: var(--download-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

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

/* ICS Download Button - Alternative class names for broader compatibility */
.ics-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--download-color);
    color: white;
    margin-right: 0.25rem;
}

.ics-download-btn:hover {
    background: var(--download-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

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

/* Input Styles */
.input-primary {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
}

.input-primary:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Card Styles */
.card-enhanced {
    background: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    transition: box-shadow var(--transition-normal);
}

.card-enhanced:hover {
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.section-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Description Styles */
.description-display {
    cursor: pointer;
    transition: background-color var(--transition-fast);
    min-height: 4rem;
    display: flex;
    align-items: center;
}

.description-display:hover {
    background-color: #f8fafc !important;
}

.description-editing {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

/* Divider */
.divider {
    position: relative;
    margin: 1rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: var(--bg-primary);
    padding: 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    position: relative;
    display: block;
    text-align: center;
}

/* Success Icon */
.success-icon {
    background: #dcfce7;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* Key Display */
.key-display {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
}

/* Participant Selection */
.participant-selection {
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: var(--border-radius-lg);
    padding: 0.75rem;
    margin-top: 1rem;
}

/* Participants Grid */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.participants-grid > div {
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    font-size: 0.875rem;
}

/* Proposal Form */
.proposal-form {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

/* Proposals Grid */
.proposals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

/* Messages Container - removed fixed height for auto-expanding */
.messages-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    min-height: 6rem;
}

.messages-container > div {
    background: var(--bg-primary);
    padding: 0.75rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.75rem;
}

.messages-container > div:last-child {
    margin-bottom: 0;
}

/* Message Form */
.message-form {
    margin-top: 1rem;
}

.message-sender-info {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.no-participant-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 1rem;
}

/* Status Indicators */
.status-available {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-maybe {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-unavailable {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Proposal Cards */
.proposal-card {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.proposal-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.proposal-card.today {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.proposal-card.past {
    opacity: 0.7;
    border-color: var(--text-tertiary);
}

/* ENHANCED: Favorite Proposal Styles - More Prominent */
.proposal-card.favorited {
    border-color: var(--favorite-color) !important;
    background: #fefce8 !important;
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2), var(--shadow-md) !important;
    position: relative;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.proposal-card.favorited:hover {
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.3), var(--shadow-lg) !important;
    transform: scale(1.03);
}

/* ENHANCED: Star/Favorite Indicator - More Visible */
.star-indicator {
    color: var(--favorite-color);
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: starGlow 2s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.6));
}

@keyframes starGlow {
    0% {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.6));
    }
    100% {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 12px rgba(234, 179, 8, 0.8);
        filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.8));
    }
}

/* ENHANCED: Proposal card border highlight for globally favorited */
.bg-yellow-50 {
    background: #fefce8 !important;
    border-color: #eab308 !important;
}

.border-yellow-400 {
    border-color: #facc15 !important;
    border-width: 2px !important;
}

/* ENHANCED: Star count styling */
.star-count {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(234, 179, 8, 0.15);
    color: var(--favorite-color);
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 1px 3px rgba(234, 179, 8, 0.2);
}

/* ENHANCED: More prominent favorite border styling */
.border-yellow-200 {
    border-color: rgba(234, 179, 8, 0.4) !important;
    border-width: 1px !important;
}

/* Star Button (Add/Remove) */
.star-button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.star-button.add-star {
    background: rgba(156, 163, 175, 0.1);
    color: #6b7280;
    border-color: rgba(156, 163, 175, 0.3);
}

.star-button.add-star:hover {
    background: rgba(234, 179, 8, 0.1);
    color: var(--favorite-color);
    border-color: rgba(234, 179, 8, 0.3);
    transform: translateY(-1px);
}

.star-button.remove-star {
    background: var(--favorite-color);
    color: white;
    border-color: var(--favorite-color);
}

.star-button.remove-star:hover {
    background: var(--favorite-hover);
    border-color: var(--favorite-hover);
    transform: translateY(-1px);
}

/* Favorite Header Styling */
.favorite-header {
    border-bottom: 1px solid rgba(234, 179, 8, 0.2);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.favorite-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--favorite-color), transparent);
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: 400px;
}

.notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--error-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    margin-top: 1rem;
    font-weight: 500;
}

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

/* Focus Visible Support */
.focus-visible:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Make datetime input fully clickable */
input[type="datetime-local"] {
    position: relative;
    cursor: pointer;
}

input[type="datetime-local"]::-webkit-datetime-edit {
    cursor: pointer;
}

input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
    cursor: pointer;
}

input[type="datetime-local"]::-webkit-datetime-edit-text {
    cursor: pointer;
}

input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field {
    cursor: pointer;
}

/* Ensure the calendar icon is visible and clickable */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 1;
}

/* Responsive adjustments for favorites and downloads */
@media (max-width: 640px) {
    .star-button,
    .btn-download,
    .ics-download-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .star-count {
        padding: 0.125rem 0.375rem;
        font-size: 0.7rem;
    }
    
    .star-indicator {
        font-size: 1rem;
    }
}

/* High contrast mode for stars and downloads */
@media (prefers-contrast: high) {
    .star-indicator {
        color: #000000;
        text-shadow: none;
    }
    
    .star-count {
        background: #ffff00;
        color: #000000;
        border-color: #000000;
    }
    
    .star-button.add-star {
        background: #ffffff;
        color: #000000;
        border-color: #000000;
    }
    
    .star-button.remove-star {
        background: #000000;
        color: #ffffff;
        border-color: #000000;
    }
    
    .btn-download,
    .ics-download-btn {
        border: 2px solid #000000 !important;
        background: #0000ff !important;
        color: #ffffff !important;
    }
    
    .btn-download:hover,
    .ics-download-btn:hover {
        background: #000080 !important;
    }
}

/* Print Styles */
@media print {
    .no-print,
    .btn-download,
    .ics-download-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card-enhanced,
    .section-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    /* Hide calendar in print */
    .calendar-day,
    #dayModal {
        display: none !important;
    }
    
    /* Show favorites clearly in print */
    .star-indicator::after {
        content: " [FAVORITE]";
        font-size: 0.75rem;
        font-weight: bold;
    }
    
    .star-button {
        display: none !important;
    }
}