/* Existing styles in common_styles.css (keep your existing styles above these) */

/* Basic Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background-color: #fefefe;
    padding: 30px;
    /* Slightly more padding for better aesthetics */
    border-radius: 12px;
    /* More rounded corners */
    width: 90%;
    /* Responsive width */
    max-width: 650px;
    /* Maximum width for larger screens */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    /* Stronger shadow for pop-up effect */
    position: relative;
    /* For positioning the close button */
    margin: auto;
    /* This helps center and provides top/bottom margin when not full screen */

    /* NEW: Constrain modal-content height and add internal scroll */
    max-height: 90vh;
    /* Limit modal content height to 90% of viewport height */
    overflow-y: auto;
    /* Enable vertical scrolling within the modal content */
}

/* Modal specific scrollbar (optional, for aesthetics if content overflows) */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.close-button {
    color: #777;
    /* Softer color */
    position: absolute;
    /* Absolute positioning relative to .modal-content */
    top: 15px;
    /* Distance from top */
    right: 20px;
    /* Distance from right */
    font-size: 32px;
    /* Larger close button */
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    /* Darker on hover */
}


/* --- Styles for Assigned Items (ODIs and Competencias) --- */
.assigned-item {
    display: flex;
    /* CRUCIAL CHANGE: Vertically center items */
    align-items: center;
    justify-content: space-between;
    /* Pushes description left, other elements right */
    flex-wrap: wrap;
    /* Allows items to wrap to the next line if space is constrained */
    padding: 0.75rem 1rem;
    background-color: #f0f4f8;
    border: 1px solid #d1d8e0;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.assigned-item .description {
    flex-grow: 1;
    /* Allow description to take available space */
    flex-shrink: 1;
    /* Allow it to shrink */
    flex-basis: 0;
    /* Let it grow from minimal size to fill space */
    min-width: 180px;
    /* Ensure description doesn't become too narrow before wrapping */
    word-break: break-word;
    /* Break long words */
    line-height: 1.2;
    color: #333;
    font-weight: 500;
    margin-right: 0.75rem;
    /* Space between description and following elements (Rango dropdown) */
}

/* Styles for the Rango select dropdowns within assigned items */
.assigned-item .rango-select {
    flex-shrink: 0;
    /* PREVENT SHRINKING - maintain its size */
    flex-grow: 0;
    /* PREVENT GROWING - maintain its size */
    min-width: 160px;
    max-width: 220px;
    height: 38px;
    /* Maintain consistent height */
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    margin-left: auto;
    /* Pushes it to the right if space allows on wrapping */
    margin-right: 0.75rem;
    /* Add space between Rango dropdown and the remove button */
    /* Ensure other Tailwind styles are still applied from your form rendering */
}

/* Styles for the remove buttons within assigned items (UPDATED FOR TEXT-BASED X) */
.assigned-item .remove-odi-button,
.assigned-item .remove-competencia-button {
    position: static;
    /* Ensure it flows naturally within the flex container */
    flex-shrink: 0;
    /* PREVENT SHRINKING - maintain its size */
    flex-grow: 0;
    /* PREVENT GROWING - maintain its size */

    /* NEW STYLES for text-based X button */
    background-color: transparent;
    /* No background */
    border: none;
    /* No border */
    padding: 0 0.25rem;
    /* Minimal padding around the text X */
    font-size: 1.125rem;
    /* Roughly text-xl size for a clear X */
    font-weight: bold;
    /* Ensures the B tag is effective */
    color: #dc2626;
    /* red-600 */
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    /* Removed width, height, border-radius as they are not applicable for a text button */
}

.assigned-item .remove-odi-button:hover,
.assigned-item .remove-competencia-button:hover {
    color: #7f1d1d;
    /* red-900 for hover effect */
    background-color: transparent;
    /* Ensure no background on hover */
}

/* Modal specific ODIs list (inside modal) */
.odi-list-checkboxes,
.competencia-list-checkboxes {
    /* Apply to both lists */
    max-height: 300px;
    /* Limit height for scrolling if many items */
    overflow-y: auto;
    /* Enable vertical scrolling */
    padding-right: 10px;
    /* Space for scrollbar */
    margin-bottom: 15px;
}

.odi-list-checkboxes .flex,
.competencia-list-checkboxes .flex {
    /* Apply to individual items within lists */
    padding: 8px 0;
    /* Add some padding to each item */
    align-items: center;
    /* Align checkbox and label */
}

/* No existing assignments message styling */
.no-existing-assignments {
    padding: 1rem;
    background-color: #fefce8;
    /* Light yellow */
    border: 1px solid #fde68a;
    /* Yellow border */
    border-radius: 0.5rem;
    color: #b45309;
    /* Amber-800 */
    text-align: center;
}

/* Global Refinements */
:root {
    --primary-red: #D3112E;
    --secondary-red: #a50d24;
    --primary-denim: #1560bd;
    --secondary-denim: #1e40af;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    --surface-glass: rgba(255, 255, 255, 0.8);
    --surface-glass-blue: rgba(59, 130, 246, 0.05);
}

.bg-denim-gradient {
    background: var(--primary-gradient);
}

.text-denim {
    color: var(--primary-denim);
}

.border-denim {
    border-color: var(--primary-denim);
}

.bg-denim {
    background-color: var(--primary-denim);
}

.glass-card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.curso-row {
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.curso-row .file-preview {
    margin-top: 10px;
    font-size: 0.9em;
    color: #555;
}

.curso-row .file-preview a {
    color: #2563eb;
    /* blue-600 */
    text-decoration: underline;
}

.curso-row.deleted {
    opacity: 0.6;
    background-color: #ffe0e0;
}

/* --- Modern Selection Modals (ODI & Competencias) --- */
.modal-dialog-modern {
    padding: 0 !important;
    border-radius: 16px !important;
    max-width: 740px !important;
    width: 92% !important;
    max-height: 85vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    background-color: #ffffff !important;
    margin: auto !important;
}

.modal-dialog-modern .modal-items-scrollable {
    padding: 16px 24px !important; /* Generous padding on left and right sides of list */
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    max-height: 52vh !important;
    box-sizing: border-box !important;
}

.modal-dialog-modern .modal-items-scrollable::-webkit-scrollbar {
    width: 6px;
}

.modal-dialog-modern .modal-items-scrollable::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

.modal-dialog-modern .modal-items-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.odi-item-card,
.competencia-item-card {
    display: flex !important;
    align-items: center !important;
    padding: 12px 18px !important; /* Generous 18px inside each card so checkbox and pts never overlap or touch borders */
    margin-bottom: 10px !important;
    border-radius: 12px !important;
    border: 1.5px solid #e2e8f0 !important;
    background-color: #ffffff !important;
    transition: all 0.15s ease-in-out !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.odi-item-card:hover {
    border-color: #c084fc !important;
    background-color: #faf5ff !important;
}

.competencia-item-card:hover {
    border-color: #86efac !important;
    background-color: #f0fdf4 !important;
}

.odi-card-checkbox-col,
.comp-card-checkbox-col {
    display: flex !important;
    align-items: center !important;
    margin-right: 14px !important;
    flex-shrink: 0 !important;
}

.odi-card-desc-col,
.comp-card-desc-col {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    padding-right: 14px !important;
}

.odi-card-badge-col,
.comp-card-badge-col {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    margin-left: auto !important;
}