/* ===============================
   GLOBAL STYLES
   =============================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* ===============================
   SCHEDULE TABLE STYLES
   =============================== */
.schedule-table {
    background-color: white;
    border: 2px solid #dee2e6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.schedule-table th {
    background-color: #6c757d !important;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 15px 8px;
    vertical-align: middle;
}

.time-slot {
    background-color: #f8f9fa;
    text-align: center;
    font-weight: bold;
    padding: 15px 8px;
    vertical-align: middle;
    min-width: 120px;
}

.schedule-cell {
    padding: 3px;
    text-align: center;
    vertical-align: middle;
    height: 55px;
    border: 2px solid #dee2e6;
    position: relative;
    min-width: 150px;
    background-color: #ffffff;
}

/* ===============================
   SUBJECT STYLES
   =============================== */
.subject {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    color: white;
    cursor: grab;
    user-select: none;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
    outline: none;
    /* Flexbox para centrar el texto verticalmente */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
}

.subject:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.subject.dragging {
    opacity: 0.6;
    transform: rotate(3deg) scale(1.05);
    cursor: grabbing !important;
    z-index: 1000;
    pointer-events: none;
}

/* Prevent hover effects during dragging */
.subject.dragging:hover {
    transform: rotate(3deg) scale(1.05) !important;
}

/* Subject Color Classes */
.subject-orange {
    background-color: #fd7e14;
}

.subject-red {
    background-color: #dc3545;
}

.subject-green {
    background-color: #00b347;
}

.subject-purple {
    background-color: #6f42c1;
}

.subject-blue {
    background-color: #0d6efd;
}

.subject-yellow {
    background-color: #ffc107;
    color: #000 !important; /* Dark text for better contrast */
}

.subject-cyan {
    background-color: #20c997;
}

.subject-pink {
    background-color: #ff69b4;
}

.subject-violet {
    background-color: #9c27b0;
}

.subject-teal {
    background-color: #17a2b8;
}

.subject-indigo {
    background-color: #6610f2;
}

.subject-lime {
    background-color: #cddc39;
    color: #000 !important;
}

.subject-coral {
    background-color: #ff7043;
}

.subject-lavender {
    background-color: #9575cd;
}

/* ===============================
   DRAG AND DROP STYLES
   =============================== */
.schedule-cell.drag-over {
    background-color: #e3f2fd;
    border: 3px dashed #2196f3;
    transform: scale(1.02);
}

.schedule-cell.valid-drop {
    background-color: #e8f5e8;
    border: 3px dashed #4caf50;
}

.schedule-cell.invalid-drop {
    background-color: #ffebee;
    border: 3px dashed #f44336;
}

/* ===============================
   SUBJECT BANK STYLES
   =============================== */
.subject-bank {
    background-color: #f8f9fa;
    border: 2px dashed #6c757d;
    min-height: 80px;
    transition: all 0.3s ease;
}

.subject-bank.drag-over {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.subject-bank .subject {
    margin: 5px;
    width: auto;
    height: auto;
    min-height: 40px;
    min-width: 60px;
    padding: 8px 16px;
    display: inline-flex;
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */
@media (max-width: 768px) {
    .schedule-table {
        font-size: 12px;
    }
    
    .subject {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .time-slot {
        padding: 10px 5px;
    }
    
    .schedule-cell {
        padding: 3px;
        height: 50px;
        min-width: 100px;
    }
}

/* ===============================
   ANIMATION STYLES
   =============================== */
@keyframes dropSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.drop-success {
    animation: dropSuccess 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.drop-error {
    animation: shake 0.3s ease;
}

/* ===============================
   BUTTON STYLES
   =============================== */
#resetSchedule {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#resetSchedule:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* ===============================
   COLOR PICKER MODAL
   =============================== */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 10px;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.color-option:hover {
    transform: scale(1.05);
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.color-sample {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.color-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-align: center;
}

/* ===============================
   UTILITY CLASSES
   =============================== */
.text-shadow {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.border-thick {
    border-width: 3px !important;
}

/* ===============================
   EDITABLE FIELDS STYLES
   =============================== */
.editable-field {
    background-color: transparent;
    border: 2px dashed transparent;
    border-radius: 4px;
    padding: 4px 8px;
    transition: all 0.3s ease;
    cursor: text;
    display: inline-block;
    min-width: 120px;
}

.editable-field:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.editable-field:focus {
    background-color: #fff;
    border-color: #0d6efd;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.editable-field:empty:before {
    content: attr(data-placeholder);
    color: #6c757d;
    font-style: italic;
}

/* Special styling for the professor name (h3) */
h3.editable-field {
    min-width: 250px;
    font-size: 1.5rem;
}

h3.editable-field:hover {
    background-color: #f8f9fa;
}

h3.editable-field:focus {
    background-color: #fff;
}

/* Info line styling */
.d-flex.flex-wrap.gap-4 {
    align-items: center;
}

.d-flex.flex-wrap.gap-4 > div {
    white-space: nowrap;
}

/* ===============================
   PRINT STYLES
   =============================== */
@media print {
    .subject-bank, #resetSchedule {
        display: none;
    }
    
    .schedule-table {
        box-shadow: none;
    }
    
    .editable-field {
        border: none !important;
        background-color: transparent !important;
    }
}