/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content */
.main {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

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

.btn.success {
    background: #28a745 !important;
    color: white !important;
    transform: scale(1.02);
}

.btn-nav {
    background: none;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 16px;
    font-size: 18px;
}

.btn-nav:hover {
    background: #f8f9fa;
}

/* Create form section */
.create-form {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.create-form h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8rem;
}

/* Result section */
.result {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.result h3 {
    margin-bottom: 20px;
    color: #28a745;
    font-size: 1.5rem;
}

.link-container {
    display: flex;
    gap: 0;
    margin: 20px 0;
    flex-wrap: wrap;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.link-container input {
    flex: 1;
    min-width: 300px;
    border: none;
    padding: 14px 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    background: #f8f9fa;
    color: #495057;
    border-right: 1px solid #dee2e6;
}

.link-container input:focus {
    outline: none;
    background: #fff;
    box-shadow: none;
}

.link-container .btn {
    border-radius: 0;
    border: none;
    padding: 14px 20px;
    margin: 0;
}

.help-text {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 15px 0;
}

/* User form */
.user-form {
    margin-bottom: 30px;
    max-width: 400px;
}

/* Calendar styles */
.calendar-container {
    margin: 30px 0;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.calendar-day {
    background: white;
    padding: 8px 4px;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.header {
    background: #495057;
    color: white;
    font-weight: 600;
    cursor: default;
    min-height: 40px;
}

.calendar-day.header:hover {
    background: #495057;
}

.calendar-day.other-month {
    color: #adb5bd;
    background: #f8f9fa;
}

.calendar-day.selected {
    background: #667eea;
    color: white;
}

.calendar-day.available {
    background: #d4edda;
    border: 2px solid #28a745;
}

.calendar-day.unavailable {
    background: #f8d7da;
    border: 2px solid #dc3545;
}

.calendar-day.mixed {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.calendar-day.mixed.user-available-border {
    border: 3px solid #2196f3;
    box-shadow: 0 0 0 1px #4caf50 inset;
}

.calendar-day.mixed.user-unavailable-border {
    border: 3px solid #ff5722;
    box-shadow: 0 0 0 1px #f44336 inset;
}

.calendar-day.user-available {
    background: #e8f5e8;
    color: #2d5a2d;
    border: 3px solid #2196f3;
    font-weight: 600;
    box-shadow: 0 0 0 1px #4caf50 inset;
}

.calendar-day.user-unavailable {
    background: #ffeaea;
    color: #8b2635;
    border: 3px solid #ff5722;
    font-weight: 600;
    box-shadow: 0 0 0 1px #f44336 inset;
}

.calendar-day .day-number {
    font-weight: 600;
    margin-bottom: 4px;
}

.calendar-day .availability-indicator {
    font-size: 0.7rem;
    color: #666;
}

.calendar-day .available-names {
    font-size: 0.6rem;
    color: #155724;
    background: rgba(40, 167, 69, 0.1);
    margin: 1px 0;
    padding: 1px 2px;
    border-radius: 2px;
    line-height: 1.1;
    word-break: break-word;
}

.calendar-day .unavailable-names {
    font-size: 0.6rem;
    color: #721c24;
    background: rgba(220, 53, 69, 0.1);
    margin: 1px 0;
    padding: 1px 2px;
    border-radius: 2px;
    line-height: 1.1;
    word-break: break-word;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid transparent;
}

.legend-color.available {
    background: #d4edda;
    border-color: #28a745;
}

.legend-color.unavailable {
    background: #f8d7da;
    border-color: #dc3545;
}

.legend-color.mixed {
    background: #fff3cd;
    border-color: #ffc107;
}

.legend-color.user-available {
    background: #e8f5e8;
    border: 3px solid #2196f3;
    box-shadow: 0 0 0 1px #4caf50 inset;
}

.legend-color.user-unavailable {
    background: #ffeaea;
    border: 3px solid #ff5722;
    box-shadow: 0 0 0 1px #f44336 inset;
}

/* Availability summary */
.availability-summary {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.availability-summary h3 {
    margin-bottom: 15px;
    color: #333;
}

.summary-day {
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #dee2e6;
}

.summary-day.has-availability {
    border-left-color: #667eea;
}

.summary-day-date {
    font-weight: 600;
    margin-bottom: 5px;
}

.summary-users {
    font-size: 0.9rem;
    color: #666;
}

/* Summary table */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.summary-table th {
    background: #667eea;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.summary-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
    font-size: 0.85rem;
}

.summary-table tr:nth-child(even) {
    background: #f8f9fa;
}

.summary-table tr:hover {
    background: #e3f2fd;
}

.summary-table .date-cell {
    font-weight: 600;
    min-width: 120px;
}

.summary-table .available-cell {
    color: #155724;
}

.summary-table .unavailable-cell {
    color: #721c24;
}

.summary-table .total-cell {
    font-weight: 600;
    text-align: center;
    color: #667eea;
}

.summary-table .score-cell {
    font-weight: 600;
    text-align: center;
    color: #28a745;
    font-size: 0.9rem;
}

.summary-table .score-cell.top-choice {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #8b6914;
    font-weight: bold;
}

.summary-table .top-choice-row {
    background: #fffbf0 !important;
    border-left: 4px solid #ffd700;
}

.summary-table .top-choice-row:hover {
    background: #fff8e1 !important;
}

.summary-table .count {
    font-weight: bold;
    font-size: 1rem;
}

.summary-table small {
    color: #666;
    word-break: break-word;
}

.summary-table small strong {
    color: #2196f3;
    font-weight: bold;
}

/* Share section */
.share-section {
    margin-top: 40px;
    padding: 20px;
    background: #e3f2fd;
    border-radius: 8px;
    text-align: center;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.redirect-message {
    color: #1976d2;
    font-weight: 600;
    margin: 15px 0;
}

.share-section h3 {
    margin-bottom: 15px;
    color: #1976d2;
}

/* Loading and utility classes */
.loading {
    text-align: center;
    padding: 40px;
}

.error-message {
    text-align: center;
    padding: 40px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    margin: 20px 0;
}

.error-message h3 {
    margin-bottom: 15px;
    color: #721c24;
}

.error-message p {
    margin: 10px 0;
}

.error-message .btn {
    margin-top: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.hidden {
    display: none;
}

/* Instructions */
.instructions {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
    color: #1976d2;
}

.instructions p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .main {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .calendar-day {
        min-height: 70px;
        padding: 8px 2px;
        font-size: 0.85rem;
    }
    
    .calendar-day .day-number {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }
    
    .link-container {
        flex-direction: column;
        gap: 1px;
    }
    
    .link-container input {
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .link-container .btn {
        border-radius: 0;
    }
    
    .calendar-header {
        flex-direction: row;
        gap: 15px;
        align-items: center;
        justify-content: center;
    }
    
    .calendar-header h2 {
        font-size: 1.3rem;
        min-width: 160px;
        text-align: center;
    }
    
    .btn-nav {
        padding: 10px 15px;
        font-size: 16px;
    }
    
    .legend {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        justify-items: start;
        margin: 15px 0;
    }
    
    .legend-item {
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .legend-color {
        width: 16px;
        height: 16px;
    }
    
    .summary-table {
        font-size: 0.8rem;
    }
    
    .summary-table th,
    .summary-table td {
        padding: 6px 2px;
        font-size: 0.75rem;
    }
    
    .summary-table .date-cell {
        min-width: 80px;
    }
    
    .calendar-day .available-names,
    .calendar-day .unavailable-names {
        font-size: 0.55rem;
        padding: 1px 2px;
        line-height: 1;
        max-height: 20px;
        overflow: hidden;
    }
    
    .calendar-day .availability-indicator {
        font-size: 0.6rem;
    }
} 