/* ── CSS Custom Properties ── */
:root {
    --clm-primary: #004078;
    --clm-primary-hover: #003366;
    --clm-accent: #0073aa;
    --clm-accent-hover: #005f8d;
    --clm-border: #ddd;
    --clm-bg-light: #f9f9f9;
    --clm-text: #333;
    --clm-text-muted: #555;
    --clm-overlay: rgba(0, 0, 0, 0.5);
    --clm-radius: 8px;
    --clm-dialog-max-width: 500px;
}

/* Shortcode dashboard spacing */
.clm-dashboard {
    margin-top: 50px;
}

/* General styling for the course cards */
.clm-course-card {
    background-color: var(--clm-bg-light);
    border: 1px solid var(--clm-border);
    border-radius: var(--clm-radius);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.clm-course-card h2 {
    font-size: 1.5em;
    margin-bottom: 8px;
}

.clm-course-card p {
    margin: 10px 0;
}

.clm-button-container {
    display: flex;
    justify-content: left;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Styling for the buttons */
.clm-course-card button {
    background-color: var(--clm-accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    width: 25%;
    min-width: 120px; /* Ensure the button has a minimum width */
    text-align: center;
    font-size: 1em;
    transition: background-color 0.3s ease;
    margin-right: 20px;
}

.clm-course-card button:hover {
    background-color: var(--clm-accent-hover);
}

/* Styling for the sub-accounts table */
.clm-sub-accounts-wrapper {
    margin-top: 20px;
    display: none;
    overflow-x: auto; 
    /* Make the table scrollable on small screens */
}

.clm-course-details-table {
    width: 100%;
    border-collapse: collapse;
    
}

.clm-course-details-table th, .clm-course-details-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.clm-course-details-table th {
    background-color: #f1f1f1;
}

.clm-empty-cell {
    text-align: center;
    color: var(--clm-text-muted);
    font-style: italic;
}

/* ── Status Badges (sub-accounts table) ── */
.clm-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.clm-status-completed {
    background: #edfaef;
    color: #00a32a;
}

.clm-status-in-progress {
    background: #e8f4fc;
    color: #2271b1;
}

.clm-status-enrolled {
    background: #fef8ee;
    color: #996800;
}

.clm-status-invited {
    background: #f0f0f1;
    color: #50575e;
}

/* ── Progress Bar ── */
.clm-progress-wrap {
    background: #e0e0e0;
    border-radius: 10px;
    height: 8px;
    width: 100%;
    max-width: 120px;
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
}

.clm-progress-bar {
    background: #2271b1;
    height: 100%;
    border-radius: 10px;
    min-width: 2px;
}

.clm-progress-done {
    background: #00a32a;
}

.clm-progress-text {
    font-size: 0.85em;
    color: #333;
    margin-left: 6px;
    vertical-align: middle;
}

.clm-progress-none {
    color: #999;
    font-style: italic;
    margin-left: 0;
}

/* Self-enrollment note (when 0 remaining) */
.clm-self-enroll-note {
    font-size: 0.9em;
    color: var(--clm-text-muted);
    font-style: italic;
    margin-top: 6px;
}

.clm-no-remaining {
    color: #996800;
    font-weight: 600;
}

/* Sub-accounts contextual note (replaces empty table) */
.clm-sub-accounts-note {
    padding: 14px 16px;
    background-color: var(--clm-bg-light);
    border: 1px solid var(--clm-border);
    border-radius: var(--clm-radius);
    color: var(--clm-text-muted);
    font-size: 0.95em;
    margin-top: 8px;
}

/* Frontend remove button */
.clm-remove-sub-btn {
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 0.85em;
    cursor: pointer;
    white-space: nowrap;
}

.clm-remove-sub-btn:hover {
    background-color: #b02a37;
}

.clm-course-details-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Dialog Styles */
.clm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--clm-overlay);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px; /* Ensure some padding on mobile screens */
}

.clm-dialog {
    background-color: #fff;
    padding: 20px;
    border-radius: var(--clm-radius);
    max-width: var(--clm-dialog-max-width);
    width: 100%;
    border: 1px solid lightgrey;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto; /* Ensure scrolling if content is too large */
    max-height: 90vh; /* Ensure the dialog doesn't exceed viewport height */
}

.clm-dialog h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #333;
}

.clm-dialog p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.clm-dialog-info {
    background: #f6f7f7;
    border: 1px solid var(--clm-border);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    color: var(--clm-text-muted);
    line-height: 1.5;
}

.clm-dialog-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--clm-text-muted);
}

.clm-dialog label {
    font-size: 1rem;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.clm-dialog input[type="text"],
.clm-dialog input[type="email"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.clm-dialog button[type="submit"] {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    color: #fff;
    background-color: var(--clm-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.clm-dialog button[type="submit"]:hover {
    font-size: 1rem;
    background-color: var(--clm-primary-hover);
}

.clm-dialog button[type="button"] {
    font-size: 1rem;
    margin-top: 10px;
    background-color: #ccc;
    color: #333;
    border: none;
    padding: 10px;
    width: 100%;
    border-radius: 4px;
    cursor: pointer;
}

/* Loading Icon */
.clm-loading {
    display: flex;
    align-items: center;
    gap: 15px; /* Adds space between the icon and text */
    margin-top: 20px;
}

.loading-icon {
    width: 50px; /* Size of the loading icon */
    height: 50px;
    animation: rotate 1s linear infinite;
}

.loading-text {
    display: flex;
    flex-direction: column;
}

.loading-text span {
    font-weight: bold;
    font-size: 1.2em;
}

.loading-text p {
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .clm-button-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .clm-course-card button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .clm-course-details-table {
        min-width: 100%; /* Adjust the minimum width for smaller screens */
    }

    .clm-dialog {
        max-width: 100%; /* Ensure the dialog fits within the screen width */
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .clm-course-card h3 {
        font-size: 1.2em;
    }

    .clm-course-card p {
        font-size: 0.9em;
    }

    .clm-dialog h3 {
        font-size: 1.2rem;
    }

    .clm-dialog p {
        font-size: 0.9rem;
    }

    .clm-dialog {
        padding: 8px; /* Reduce padding for very small screens */
        padding-left: 20px; /* Add left padding */
        padding-right: 20px; /* Add right padding */
    }

    .clm-dialog input[type="text"],
    .clm-dialog input[type="email"] {
        font-size: 0.8rem; /* Adjust font size for smaller screens */
    }

    .clm-dialog button[type="submit"],
    .clm-dialog button[type="button"] {
        font-size: 0.9rem; /* Adjust button font size for smaller screens */
        padding: 6px; /* Adjust button padding for smaller screens */
    }
}
