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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 2rem 3rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-box h1 {
    margin-bottom: 0.5rem;
    color: #333;
}

.login-box p {
    margin-bottom: 1.5rem;
    color: #666;
}

.discord-button {
    background-color: #5865F2;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

.discord-button:hover {
    background-color: #4752C4;
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.app-header {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-header h1 {
    color: #333;
    font-size: 1.5rem;
}

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

/* Timezone Select Wrapper */
.timezone-select-wrapper {
    position: relative;
    min-width: 200px;
}

.timezone-select-display {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: border-color 0.2s;
}

.timezone-select-display:hover {
    border-color: #667eea;
}

.timezone-select-display.open {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.timezone-arrow {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.timezone-select-display.open .timezone-arrow {
    transform: rotate(180deg);
}

.timezone-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.timezone-search {
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    outline: none;
    background: white;
}

.timezone-search:focus {
    border-bottom-color: #667eea;
}

.timezone-list {
    overflow-y: auto;
    max-height: 250px;
    padding: 4px 0;
}

.timezone-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    user-select: none;
}

.timezone-item:hover {
    background-color: #f0f0f0;
}

.timezone-item.selected {
    background-color: #667eea;
    color: white;
}

.timezone-item.highlighted {
    background-color: #e8f4f8;
}

.timezone-item.highlighted.selected {
    background-color: #5568d3;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
    color: #666;
}

.logout-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.logout-button:hover {
    background-color: #c82333;
}

/* Calendar Container */
.calendar-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.calendar-nav h2 {
    color: #333;
    font-size: 1.5rem;
}

.nav-button {
    background-color: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.nav-button:hover {
    background-color: #5568d3;
}

/* Calendar Actions */
.calendar-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.add-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-button:hover {
    background-color: #218838;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.help-text {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #ddd;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.calendar-day-header {
    background-color: #667eea;
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.calendar-day {
    background-color: white;
    min-height: 100px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
}

.calendar-day:hover {
    background-color: #e8f4f8;
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.calendar-day::after {
    content: '+';
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    color: #667eea;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}

.calendar-day:hover::after {
    opacity: 0.5;
}

.calendar-day.empty {
    background-color: #f9f9f9;
    cursor: default;
}

.calendar-day.empty:hover {
    background-color: #f9f9f9;
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #333;
}

.shift-item {
    background-color: #667eea;
    color: white;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: opacity 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shift-item:hover {
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 1rem;
    top: 1rem;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: #333;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-content label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
}

.modal-content input,
.modal-content textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.submit-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.submit-button:hover {
    background-color: #218838;
}

.delete-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.delete-button:hover {
    background-color: #c82333;
}

.cancel-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.cancel-button:hover {
    background-color: #5a6268;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .timezone-select-wrapper {
        width: 100%;
        min-width: auto;
    }
    
    .timezone-dropdown {
        max-height: 250px;
    }
    
    .timezone-list {
        max-height: 200px;
    }
    
    .calendar-nav {
        flex-direction: column;
        text-align: center;
    }
    
    .calendar-day {
        min-height: 80px;
    }
    
    .shift-item {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .calendar-grid {
        font-size: 0.85rem;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }
    
    .day-number {
        font-size: 0.9rem;
    }
    
    .shift-item {
        font-size: 0.65rem;
        padding: 2px 4px;
    }
}

/* Availability Modal Styles */
.availability-modal {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.availability-modal .modal-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #333;
}

.availability-name-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 1.5rem;
    font-family: inherit;
}

.availability-name-input:focus {
    outline: none;
    border-color: #28a745;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #333;
}

.tab-button.active {
    color: #28a745;
    border-bottom-color: #28a745;
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

/* Time Range Selector */
.time-range-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.time-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    flex: 1;
}

.time-separator {
    color: #666;
    font-weight: 500;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    color: #333;
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-icon {
    font-size: 18px;
    color: #999;
}

/* Date Type Select */
.date-type-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    width: 100%;
    margin-bottom: 1rem;
}

/* Calendar Picker */
.calendar-picker {
    margin-top: 1rem;
}

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

.calendar-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.calendar-nav-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    border-radius: 3px;
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.5rem;
}

.weekday {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
    padding: 5px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: white;
    border: 1px solid transparent;
}

.calendar-day-cell:hover {
    background-color: #e8f4f8;
    border-color: #28a745;
}

.calendar-day-cell.selected {
    background-color: #28a745;
    color: white;
    font-weight: 600;
}

.calendar-day-cell.empty {
    cursor: default;
    background: transparent;
    border: none;
}

.calendar-day-cell.empty:hover {
    background: transparent;
}

/* Sign In Prompt */
.sign-in-prompt {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* Advanced Options */
.advanced-options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.advanced-options-header .section-title {
    margin-bottom: 0;
}

.chevron-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    transition: transform 0.2s;
}

.chevron-btn:hover {
    color: #333;
}

.advanced-options-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.advanced-options-content label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.advanced-options-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

/* Create Button */
.create-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.create-button:hover {
    background-color: #218838;
}

/* Responsive for Availability Modal */
@media (max-width: 768px) {
    .availability-modal {
        width: 95%;
        max-height: 95vh;
        padding: 1.5rem;
    }
    
    .modal-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        text-align: left;
        border-bottom: none;
        border-left: 3px solid transparent;
        margin-bottom: 0;
    }
    
    .tab-button.active {
        border-left-color: #28a745;
        border-bottom-color: transparent;
    }
    
    .time-range-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-separator {
        text-align: center;
    }
}

/* Overview Styles */
.overview-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.overview-title-section {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.overview-title {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.overview-date-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.week-nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.week-nav-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #d0d0d0;
    background: #f5f5f5;
    color: #555;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.week-nav-button:hover {
    background: #e0e0e0;
    color: #333;
}

.overview-date-range {
    color: #666;
    font-size: 0.9rem;
}

.edit-link {
    color: #28a745;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.edit-link:hover {
    text-decoration: underline;
}

.overview-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.copy-link-button {
    background: white;
    border: 2px solid #28a745;
    color: #28a745;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.copy-link-button:hover {
    background: #f0f8f0;
}

.copy-icon {
    font-size: 16px;
}

.overview-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.weekly-grid-container {
    flex: 1;
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    position: relative;
}

.weekly-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    min-width: 1000px;
    background: white;
}

.time-header {
    grid-column: 1;
    background: #f9f9f9;
    border-right: 1px solid #e0e0e0;
    padding: 10px;
    font-weight: 600;
    color: #666;
}

.day-header {
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.time-label {
    background: #f9f9f9;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 5px 10px;
    font-size: 0.85rem;
    color: #666;
    text-align: right;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.time-cell {
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    min-height: 60px;
    position: relative;
    cursor: pointer;
    background: white;
    transition: background 0.2s;
}

.time-cell:hover {
    background: #f5f9ff;
}

.shift-block {
    position: absolute;
    left: 2px;
    right: 2px;
    top: 0;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.shift-block:hover {
    opacity: 0.9;
    z-index: 20;
}

/* Shiftmanager Sidebar */
.shiftmanager-sidebar {
    width: 280px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

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

.empty-message {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
    margin: 0;
}

.shiftmanager-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.2s;
}

.shiftmanager-item:hover {
    background: #f5f5f5;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.user-info-item {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-shift-count {
    font-size: 0.85rem;
    color: #666;
}

/* Responsive for Overview */
@media (max-width: 1200px) {
    .overview-content {
        flex-direction: column;
    }
    
    .shiftmanager-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .shiftmanager-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .overview-container {
        padding: 1rem;
    }
    
    .overview-header {
        flex-direction: column;
    }
    
    .overview-title {
        font-size: 1.5rem;
    }
    
    .overview-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .copy-link-button,
    .add-button {
        width: 100%;
    }
    
    .weekly-grid {
        min-width: 600px;
    }
    
    .day-header {
        font-size: 0.8rem;
        padding: 10px 5px;
    }
    
    .time-label {
        font-size: 0.75rem;
        padding: 5px;
        min-height: 50px;
    }
    
    .time-cell {
        min-height: 50px;
    }
}

