/* ============================================
   GROUP SCHEDULER TOOL STYLES
   ============================================ */

/* Main Container */
.scheduler-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-md);
}

/* Screen Management */
.scheduler-screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.scheduler-screen.active {
    display: block;
}

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

/* Mode Selection Screen */
.mode-selection {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}

.mode-selection h2 {
    color: var(--color-text-dark);
    margin-bottom: var(--space-2xl);
    font-size: 2rem;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.mode-card {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all 0.3s ease;
    cursor: pointer;
}

.mode-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.mode-card h3 {
    color: var(--color-text-dark);
    margin-bottom: var(--space-sm);
}

.mode-card p {
    color: var(--color-text-medium);
    margin-bottom: var(--space-lg);
}

/* Import Section */
.import-section {
    margin-top: var(--space-2xl);
    padding-top: var(--space-2xl);
    border-top: 2px solid var(--color-border);
}

.import-section h3 {
    color: var(--color-text-medium);
    font-size: 1.1rem;
    margin-bottom: var(--space-lg);
}

.import-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Screen Header */
.screen-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--color-border);
}

.screen-header h2 {
    flex: 1;
    margin: 0;
    color: var(--color-text-dark);
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 1rem;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    margin-right: var(--space-md);
    transition: background 0.2s ease;
}

.btn-back:hover {
    background: rgba(13, 148, 136, 0.1);
    border-radius: var(--radius-sm);
}

/* Form Styles */
.poll-config, .join-options {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: var(--space-sm);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

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

.password-input.hidden {
    display: none;
}

/* Sync Mode Selector */
.sync-mode-selector {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.radio-label:hover {
    border-color: var(--color-primary);
}

.radio-label input[type="radio"] {
    margin-right: var(--space-sm);
}

.radio-label input[type="radio"]:checked + span {
    color: var(--color-primary);
    font-weight: 600;
}

/* Slot Builder */
.slot-builder {
    background: #F9FAFB;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.slot-builder-controls {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.slot-builder-controls input {
    flex: 1;
    min-width: 120px;
}

.slots-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.slot-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.slot-item-time {
    font-weight: 600;
    color: var(--color-text-dark);
}

.slot-item-remove {
    background: transparent;
    border: none;
    color: var(--color-error);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    font-size: 1.2rem;
}

.slot-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

/* Buttons */
.btn {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #0a7068;
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #ea580c;
}

.btn-outline {
    background: white;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-large {
    padding: var(--space-md) var(--space-2xl);
    font-size: 1.1rem;
    width: 100%;
}

/* Poll Screen */
.poll-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.poll-info h2 {
    color: var(--color-text-dark);
    margin-bottom: var(--space-sm);
}

.poll-info p {
    color: var(--color-text-medium);
    margin-bottom: var(--space-md);
}

.poll-meta {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.poll-meta span {
    padding: var(--space-xs) var(--space-sm);
    background: #F9FAFB;
    border-radius: var(--radius-sm);
}

.poll-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.poll-status-badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
}

.poll-status-badge.active {
    background: #D1FAE5;
    color: #065F46;
}

.poll-status-badge.closed {
    background: #FEE2E2;
    color: #991B1B;
}

/* Participant Section */
.participant-section {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: #FFF7ED;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-secondary);
}

/* Voting Grid */
.voting-grid-container {
    overflow-x: auto;
    margin-bottom: var(--space-xl);
}

.voting-grid {
    display: grid;
    gap: var(--space-xs);
    min-width: 600px;
}

.grid-header {
    display: contents;
}

.grid-cell {
    padding: var(--space-sm);
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9rem;
}

.grid-cell.header {
    background: #F9FAFB;
    font-weight: 600;
    color: var(--color-text-dark);
}

.grid-cell.slot-header {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

.vote-buttons {
    display: flex;
    gap: var(--space-xs);
    justify-content: center;
}

.vote-btn {
    padding: var(--space-xs) var(--space-sm);
    border: 2px solid var(--color-border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.vote-btn:hover {
    transform: scale(1.1);
}

.vote-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.vote-btn.yes.selected {
    background: var(--color-success);
    border-color: var(--color-success);
}

.vote-btn.maybe.selected {
    background: #F59E0B;
    border-color: #F59E0B;
}

.vote-btn.no.selected {
    background: var(--color-error);
    border-color: var(--color-error);
}

/* Heatmap */
.heatmap-container {
    margin: var(--space-xl) 0;
}

.heatmap-grid {
    display: grid;
    gap: var(--space-sm);
}

.heatmap-cell {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    text-align: center;
    transition: all 0.3s ease;
}

.heatmap-cell:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.heatmap-slot-time {
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: var(--space-sm);
}

.heatmap-stats {
    display: flex;
    justify-content: space-around;
    margin-top: var(--space-sm);
    font-size: 0.9rem;
}

.stat-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

/* Recommendation Card */
.recommendation-card {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    border: 2px solid var(--color-success);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    text-align: center;
}

.recommendation-card h4 {
    color: #065F46;
    margin-bottom: var(--space-md);
    font-size: 1.5rem;
}

/* Host Controls */
.host-controls {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-top: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.host-controls h3 {
    margin-bottom: var(--space-lg);
    color: var(--color-text-dark);
}

.host-action-buttons {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--color-text-dark);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-text-medium);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: #F9FAFB;
}

.modal-body {
    padding: var(--space-lg);
}

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

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Info Section */
.info-section {
    margin-top: var(--space-2xl);
    padding: var(--space-2xl);
    background: #F9FAFB;
    border-radius: var(--radius-lg);
}

.info-section h2 {
    color: var(--color-text-dark);
    margin-bottom: var(--space-lg);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.feature-card {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.feature-card h3 {
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

/* QR Scanner */
.qr-scanner-section {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 2px solid var(--color-border);
    text-align: center;
}

#qr-video-container {
    margin-top: var(--space-lg);
}

#qr-video {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Payload Warning Banner */
.payload-warning-banner {
    animation: slideDown 0.3s ease-out;
}

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

/* Print Styles */
@media print {
    .poll-actions,
    .host-controls,
    .btn,
    .modal-overlay,
    .loading-indicator,
    .screen-header,
    .import-section,
    #submit-vote-section,
    #ingest-responses-section {
        display: none !important;
    }
    
    .poll-header {
        border: none;
        box-shadow: none;
    }
    
    .voting-grid,
    .heatmap-container {
        page-break-inside: avoid;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }
    
    .poll-header {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .poll-actions {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .slot-builder-controls {
        flex-direction: column;
    }
    
    .import-buttons {
        flex-direction: column;
    }
    
    .host-action-buttons {
        flex-direction: column;
    }
}

/* ============================================
   ICS CALENDAR IMPORT - CONFLICT ANALYZER
   ============================================ */

/* Participant ICS Import Dropzone */
label[for="participant-ics-import"] {
    transition: all 0.3s ease;
}

label[for="participant-ics-import"]:hover {
    border-color: var(--color-primary);
    background: #F0FDF4 !important;
    transform: translateY(-2px);
}

.calendar-auto-fill-hint {
    animation: slideInDown 0.4s ease-out;
}

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

/* Host Calendar Analysis Section */
#host-calendar-analysis {
    animation: fadeIn 0.5s ease-in;
}

.conflict-heatmap {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 #F7FAFC;
}

.conflict-heatmap::-webkit-scrollbar {
    width: 8px;
}

.conflict-heatmap::-webkit-scrollbar-track {
    background: #F7FAFC;
    border-radius: 4px;
}

.conflict-heatmap::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 4px;
}

.conflict-heatmap::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

.heatmap-day-section {
    animation: fadeInUp 0.3s ease-out;
}

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

.heatmap-bucket-cell {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.heatmap-bucket-cell:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Suggestion Modal Styles */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Import Status Indicator */
.import-status {
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Conflict Legend */
.conflict-heatmap > div:last-child {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 2px solid #E5E7EB;
    margin-top: 10px;
}

/* Mobile - Calendar Import Adjustments */
@media (max-width: 768px) {
    #host-calendar-analysis {
        padding: 10px;
    }
    
    #conflict-heatmap {
        max-height: 300px;
    }
    
    .heatmap-bucket-cell {
        font-size: 0.7em;
        padding: 4px;
    }
    
    label[for="participant-ics-import"] {
        font-size: 0.9em;
        padding: 12px;
    }
}

@media print {
    .info-section, .tool-page-header, footer, header {
        display: none !important;
    }
}
