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

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

/* App container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: #fbbf24;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Navigation tabs */
.nav-tabs {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 2rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.nav-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: #64748b;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    color: #475569;
    background-color: #f1f5f9;
}

.nav-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background-color: #eff6ff;
}

.nav-tab i {
    font-size: 1.1rem;
}

/* Main content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Tab content */
.tab-content {
    display: none;
}

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

/* Section headers */
.section-header {
    margin-bottom: 2rem;
    text-align: center;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

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

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Forms */
.schedule-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    max-width: 600px;
    margin: 0 auto 3rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

/* Availability grid */
.availability-grid {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.availability-row {
    display: grid;
    grid-template-columns: 80px 1fr 30px 1fr;
    align-items: center;
    gap: 0.5rem;
}

.availability-row span {
    font-size: 0.9rem;
    color: #6b7280;
}

.availability-row input[type="time"] {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

/* Entities grid */
.entities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.entity-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.entity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

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

.entity-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.entity-actions {
    display: flex;
    gap: 0.5rem;
}

.entity-actions button {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.entity-actions button:hover {
    background: #f3f4f6;
    color: #374151;
}

.entity-details {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

.entity-details div {
    margin-bottom: 0.5rem;
}

.entity-details strong {
    color: #374151;
}

/* Schedules list */
.schedules-list {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.schedule-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    cursor: pointer;
}

.schedule-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.schedule-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.schedule-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.schedule-date {
    color: #6b7280;
    font-size: 0.9rem;
}

.schedule-description {
    color: #6b7280;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.schedule-actions {
    display: flex;
    gap: 0.5rem;
}

/* Schedule display */
.schedule-display {
    margin-top: 3rem;
}

.schedule-summary {
    margin-bottom: 2rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6b7280;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-distribution {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.day-distribution h4 {
    margin-bottom: 1rem;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
}

.day-stats {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}

.day-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
}

.day-stat.day-with-tasks {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.day-stat.day-no-tasks {
    background: #fef2f2;
    border-color: #e5e7eb;
    color: #6b7280;
}

.day-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.day-count {
    font-size: 1.25rem;
    font-weight: 700;
}

.day-hours {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* Gantt chart */
.gantt-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.gantt-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.gantt-timeline {
    display: grid;
    grid-template-columns: 200px repeat(7, 1fr);
    gap: 1px;
    background: #e2e8f0;
}

.gantt-time-scale {
    display: grid;
    grid-template-columns: 200px repeat(9, 1fr);
    gap: 1px;
    background: #e2e8f0;
    border-top: 1px solid #e2e8f0;
}

.time-scale-cell {
    background: #f1f5f9;
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    border-right: 1px solid #e2e8f0;
}

.time-scale-cell:first-child {
    background: #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

.day-header {
    background: #f8fafc;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #374151;
    border-right: 1px solid #e2e8f0;
}

.day-header:first-child {
    text-align: left;
    background: #f1f5f9;
    font-weight: 700;
}

.empty-header {
    background: #e2e8f0 !important;
    border-right: 1px solid #e2e8f0;
}

.gantt-body {
    background: white;
}

.gantt-row {
    display: grid;
    grid-template-columns: 200px repeat(7, 1fr);
    gap: 1px;
    background: #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.gantt-character {
    background: #f8fafc;
    padding: 1rem;
    border-right: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
}

.character-name {
    font-weight: 600;
    color: #374151;
}

.day-cell {
    background: white;
    padding: 0.5rem;
    position: relative;
    min-height: 80px;
    border-right: 1px solid #e2e8f0;
    overflow: visible;
}

.day-cell.empty {
    background: #fafafa;
}

.gantt-task {
    position: absolute;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 60px;
}

.gantt-task:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    z-index: 2;
}

/* Custom Task Tooltip */
.task-tooltip {
    position: fixed;
    display: none;
    background: #1f2937;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    max-width: 280px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    pointer-events: none;
    transform: translateX(-50%);
    margin-top: -10px;
}

.task-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #1f2937;
}

.tooltip-header {
    border-bottom: 1px solid #374151;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.tooltip-day {
    font-size: 0.75rem;
    color: #60a5fa;
    font-weight: 500;
    margin-top: 0.25rem;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-label {
    color: #9ca3af;
    font-weight: 500;
    margin-right: 1rem;
}

.tooltip-value {
    color: white;
    font-weight: 600;
}

.tooltip-value.no-resources {
    color: #9ca3af;
    font-style: italic;
}

/* Gantt Chart Legend */
.gantt-legend {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-color.overlap {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.legend-color.time-scale {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.task-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}

.task-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-time {
    font-size: 0.65rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Schedule details */
.schedule-details {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.schedule-details h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: center;
}

.day-schedule {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.day-schedule h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.day-tasks {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.task-time {
    font-weight: 600;
    color: #3b82f6;
    min-width: 120px;
}

.task-info {
    flex: 1;
}

.task-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.task-details {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.task-character {
    color: #059669;
}

.task-duration {
    color: #dc2626;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

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

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

.loading-spinner {
    text-align: center;
    color: #3b82f6;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1.1rem;
    color: #374151;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 3000;
    border-left: 4px solid #10b981;
}

.notification.error {
    border-left-color: #ef4444;
}

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

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification i {
    font-size: 1.25rem;
}

.notification.success i {
    color: #10b981;
}

.notification.error i {
    color: #ef4444;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .nav-tabs {
        padding: 0 1rem;
    }
    
    .nav-tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .nav-tab span {
        display: none;
    }
    
    .gantt-timeline {
        grid-template-columns: 150px repeat(7, 1fr);
    }
    
    .gantt-time-scale {
        grid-template-columns: 150px repeat(9, 1fr);
    }
    
    .gantt-row {
        grid-template-columns: 150px repeat(7, 1fr);
    }
    
    .gantt-character {
        padding: 0.75rem;
    }
    
    .day-header {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .time-scale-cell {
        padding: 0.25rem 0.125rem;
        font-size: 0.65rem;
    }
    
    .gantt-legend {
        padding: 0.75rem;
        gap: 1rem;
    }
    
    .legend-item {
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .entities-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }
    
    .gantt-timeline {
        grid-template-columns: 120px repeat(7, 1fr);
    }
    
    .gantt-time-scale {
        grid-template-columns: 120px repeat(9, 1fr);
    }
    
    .gantt-row {
        grid-template-columns: 120px repeat(7, 1fr);
    }
    
    .gantt-character {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .day-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
    }
    
    .time-scale-cell {
        padding: 0.25rem 0.125rem;
        font-size: 0.6rem;
    }
    
    .gantt-legend {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
}
