@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');

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

body {
    font-family: 'Lato', sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    font-size: 15px;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    max-width: 100vw;
    overflow-x: hidden;
}

.header {
    background: #242424;
    border-bottom: 1px solid #333;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    max-width: 100vw;
    overflow: hidden;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.logo-separator {
    color: #666;
    font-size: 24px;
    font-weight: 300;
    flex-shrink: 0;
}

h1 {
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.header-actions button {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top-color: #F26D3D;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.error {
    background: #3d1a1a;
    border: 1px solid #5a2020;
    color: #ff6b6b;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 24px;
    font-size: 14px;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.project-list-section {
    background: #242424;
    border-right: 1px solid #333;
    padding: 20px;
    overflow-y: auto;
    width: 100%;
    order: 1;
}

/* Custom scrollbar for project list */
.project-list-section::-webkit-scrollbar {
    width: 8px;
}

.project-list-section::-webkit-scrollbar-track {
    background: transparent;
}

.project-list-section::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.project-list-section:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.project-list-section::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.resizer {
    width: 4px;
    cursor: col-resize;
    background: #333;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}

.resizer:hover {
    background: #F26D3D;
}

.resizer:active {
    background: #F26D3D;
}

.calendar-section {
    background: #1a1a1a;
    flex: 1;
    overflow-y: auto;
    order: 2;
}

.project-list-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #fff;
    font-weight: 600;
}

.search-container {
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #F26D3D;
    background: #242424;
    box-shadow: 0 0 0 3px rgba(242, 109, 61, 0.1);
}

.search-input::placeholder {
    color: #666;
}

.filter-controls {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #2a2a2a;
    border-radius: 8px;
    border: 1px solid #333;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a2a2a;
    transition: .3s;
    border-radius: 24px;
    border: 1px solid #333;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #F26D3D;
    border-color: #F26D3D;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-slider:hover {
    box-shadow: 0 0 8px rgba(242, 109, 61, 0.3);
}

/* Status Legend */
.status-legend {
    margin-bottom: 20px;
    padding: 12px;
    background: #2a2a2a;
    border-radius: 8px;
    border: 1px solid #333;
}

.legend-title {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Legend color indicators */
.legend-item.request .legend-color {
    background: #fff;
    color: #000;
}

.legend-item.confirmed .legend-color {
    background: #ffc107;
    color: #000;
}

.legend-item.confirmed-by-bart .legend-color {
    background: #4caf50;
    color: #000;
}

.legend-item.canceled .legend-color {
    background: #f44336;
    color: #000;
}

.legend-text {
    font-size: 13px;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.month-group {
    margin-bottom: 24px;
}

.month-group-header {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-card {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid #F26D3D;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 100%;
    overflow: hidden;
}

.project-card:hover {
    background: #333;
    transform: translateX(4px);
}

.project-card.request {
    border-left-color: #fff;
}

.project-card.confirmed {
    border-left-color: #ffc107;
}

.project-card.confirmed-by-bart {
    border-left-color: #4caf50;
}

.project-card.canceled {
    border-left-color: #f44336;
    opacity: 0.6;
}

.project-card-title {
    font-weight: 600;
    font-size: 16px;
    color: #fff;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.project-card-meta {
    font-size: 13px;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.project-card-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.calendar {
    background: #1a1a1a;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #242424;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.calendar-header h2 {
    font-size: 22px;
    color: #fff;
    font-weight: 600;
}

.calendar-nav-buttons {
    display: flex;
    gap: 8px;
}

.calendar-nav-buttons button {
    padding: 8px 16px;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 16px;
    transition: all 0.2s;
}

.calendar-nav-buttons button:hover {
    background: #333;
    border-color: #F26D3D;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    background: #1a1a1a;
    flex: 1;
    overflow: auto;
}

.calendar-day-header {
    background: #242424;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    border-right: 1px solid #333;
}

.calendar-day-header:last-child {
    border-right: none;
}

.calendar-day {
    background: #1a1a1a;
    min-height: 100px;
    padding: 8px 4px 4px 4px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #333;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

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

.calendar-day.creating {
    animation: pulse 0.6s ease-in-out;
    background: #3d2a1a !important;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(242, 109, 61, 0.5); }
}

.calendar-day.other-month {
    background: #141414;
    color: #666;
}

.calendar-day.today {
    background: #2a2020;
}

.calendar-day-number {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: #e0e0e0;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-day.other-month .calendar-day-number {
    color: #666;
}

.calendar-events-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
}

.calendar-event {
    background: #F26D3D;
    color: white;
    padding: 3px 6px;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
    line-height: 1.3;
    width: 100%;
    box-sizing: border-box;
    min-height: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    white-space: normal;
}

.calendar-event.spanning-start {
    border-radius: 2px 0 0 2px;
    padding-right: 4px;
}

.calendar-event.spanning-middle {
    border-radius: 0;
    padding-left: 4px;
    padding-right: 4px;
}

.calendar-event.spanning-end {
    border-radius: 0 2px 2px 0;
    padding-left: 4px;
}

.calendar-event.spanning-single {
    border-radius: 2px;
}

.calendar-event:hover {
    opacity: 0.8;
}

.calendar-event.request {
    background: #fff;
    color: #000;
    font-weight: 700;
}

.calendar-event.confirmed {
    background: #ffc107;
    color: #000;
    font-weight: 700;
}

.calendar-event.confirmed-by-bart {
    background: #4caf50;
    color: #000;
    font-weight: 700;
}

.calendar-event.canceled {
    background: #f44336;
    color: #000;
    font-weight: 700;
    text-decoration: line-through;
}

.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status.request {
    background: #333;
    color: #fff;
    border: 1px solid #666;
}

.status.confirmed {
    background: #3d3300;
    color: #ffc107;
    border: 1px solid #665500;
}

.status.confirmed-by-bart {
    background: #1a3d1a;
    color: #4caf50;
    border: 1px solid #2d5a2d;
}

.status.canceled {
    background: #3d1a1a;
    color: #f44336;
    border: 1px solid #5a2020;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

button:hover {
    transform: translateY(-1px);
}

.btn-refresh {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #333;
}

.btn-refresh:hover {
    background: #333;
    border-color: #F26D3D;
}

.btn-add {
    background: #F26D3D;
    color: white;
}

.btn-add:hover {
    background: #d95a2d;
}

.btn-edit {
    background: #F26D3D;
    color: white;
    padding: 6px 12px;
}

.btn-delete {
    background: #f44336;
    color: white;
    padding: 6px 12px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #242424;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #333;
}

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

.modal-header h2 {
    margin: 0;
    color: #fff;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #F26D3D;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    background-color: #1a1a1a;
    color: #e0e0e0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #F26D3D;
    background-color: #242424;
    box-shadow: 0 0 0 3px rgba(242, 109, 61, 0.1);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: #444;
    background-color: #212121;
}

/* Custom Select Dropdown Styling */
.form-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group select:hover {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F26D3D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.form-group select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F26D3D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Basic option styling - note: browser support for option styling is limited */
.form-group select option {
    background: #2a2a2a;
    color: #e0e0e0;
    padding: 12px;
}

/* Datalist Input Enhancements */
.form-group input[list] {
    position: relative;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 40px;
}

/* Hide the default datalist dropdown arrow */
.form-group input[list]::-webkit-calendar-picker-indicator {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.form-group input[list]:hover {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F26D3D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-save {
    background: #F26D3D;
    color: white;
    padding: 12px 24px;
}

.btn-save:hover {
    background: #d95a2d;
}

.btn-cancel {
    background: #2a2a2a;
    color: #e0e0e0;
    padding: 12px 24px;
    border: 1px solid #333;
}

.btn-cancel:hover {
    background: #333;
}

/* Build ID Display */
.build-id {
    position: fixed;
    bottom: 8px;
    left: 8px;
    font-size: 9px;
    color: #444;
    font-family: 'Courier New', monospace;
    opacity: 0.4;
    pointer-events: none;
    z-index: 100;
    user-select: none;
    transition: opacity 0.3s;
}

.build-id:hover {
    opacity: 0.8;
}

/* Mobile styles */
@media (max-width: 768px) {
    body {
        overflow: hidden;
        height: 100vh;
    }
    
    .container {
        height: 100vh;
        overflow: hidden;
    }
    
    .header {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
        gap: 8px;
    }
    
    .logo {
        height: 28px;
    }
    
    .logo-separator {
        font-size: 18px;
    }
    
    h1 {
        font-size: 16px;
    }
    
    .header-actions {
        gap: 6px;
        flex-shrink: 0;
    }
    
    .header-actions button {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .main-layout {
        flex-direction: column;
        overflow: hidden;
        flex: 1;
    }
    
    .project-list-section {
        order: 1;
        border-right: none;
        border-bottom: none;
        width: 100%;
        flex: 1;
        overflow-y: auto;
    }
    
    .resizer {
        display: none;
    }
    
    .calendar-section {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    .logo {
        height: 50px;
    }
    
    .logo-separator {
        font-size: 28px;
    }
    
    .main-layout {
        flex-direction: row;
    }
    
    .project-list-section {
        width: 350px;
        order: 1;
        border-right: none;
        min-width: 200px;
        max-width: 600px;
    }
    
    .resizer {
        order: 2;
    }
    
    .calendar-section {
        order: 3;
        flex: 1;
    }
}
