/* DLMS Public Styles */

/* --- Course Grid --- */
.dlms-course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.dlms-course-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

.dlms-course-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.dlms-course-image {
    width: 100%;
    height: 180px;
    position: relative;
    overflow: hidden;
    background-color: #f9f9f9;
}

.dlms-course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.dlms-course-item:hover .dlms-course-image img {
    transform: scale(1.05);
}

.dlms-course-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.dlms-course-item h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 700;
}

.dlms-course-item h3 a {
    text-decoration: none;
    color: #2c3e50;
    transition: color 0.2s;
}

.dlms-course-item h3 a:hover {
    color: var(--dlms-primary, #0073aa);
}

.dlms-course-meta-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    color: #666;
    font-size: 0.95rem;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    justify-content: center;
    /* Center align items */
}

.dlms-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dlms-meta-item .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--dlms-primary, #0073aa);
}

.dlms-course-price {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1rem;
}

.dlms-course-footer {
    margin-top: auto;
}

/* Specific button styling to override theme defaults */
a.dlms-button {
    background: var(--dlms-button-bg, #0073aa) !important;
    color: var(--dlms-button-text, #fff) !important;
    text-decoration: none !important;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    display: block;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
}

a.dlms-button:hover {
    background: var(--dlms-button-bg, #0073aa);
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    color: var(--dlms-button-text, #fff) !important;
}

/* --- Auth Forms --- */
.dlms-auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background-color: #f5f7fa;
}

.dlms-auth-form {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.dlms-auth-form h3 {
    margin-top: 0;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 700;
}

.dlms-input-group {
    position: relative;
    margin-bottom: 20px;
}

.dlms-input-group .dashicons {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 20px;
    pointer-events: none;
}

.dlms-auth-form input[type="text"],
.dlms-auth-form input[type="email"],
.dlms-auth-form input[type="password"] {
    width: 100%;
    padding: 12px 12px 12px 45px;
    /* Space for icon */
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: #f9f9f9;
    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
    height: auto;
    margin: 0;
}

.dlms-auth-form input:focus {
    border-color: var(--dlms-primary, #0073aa);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    outline: none;
    background-color: #fff;
}

button.dlms-auth-button {
    width: 100%;
    padding: 14px;
    background: var(--dlms-button-bg, #0073aa);
    color: var(--dlms-button-text, #fff);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
    display: block;
}

button.dlms-auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: var(--dlms-button-bg, #0073aa);
    filter: brightness(1.1);
}

.dlms-error {
    background: #ffe6e6;
    color: #d63031;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: left;
    border-left: 4px solid #d63031;
}

.dlms-success {
    background: #e6ffea;
    color: #27ae60;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid #27ae60;
}

.dlms-auth-message {
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

/* --- Dashboard Styles --- */
.dlms-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.dlms-dashboard-card {
    background: var(--dlms-card-bg, #fff);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Softer shadow */
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    display: flex;
    flex-direction: column;
}

.dlms-dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.dlms-dashboard-card .dlms-course-image {
    height: 160px;
}

.dlms-dashboard-content {
    padding: 30px;
    /* More breathing room */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dlms-dashboard-card h4 {
    margin: 0 0 5px;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
}

.dlms-dashboard-card h4 a {
    text-decoration: none;
    color: #333;
    transition: color 0.2s;
}

.dlms-dashboard-card h4 a:hover {
    color: var(--dlms-primary, #0073aa);
}

.dlms-progress-wrapper {
    margin-bottom: 20px;
}

.dlms-progress-bar {
    background-color: #f0f2f5;
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.dlms-progress-bar span {
    display: block;
    height: 100%;
    background-color: #27ae60;
    /* Success Green for progress */
    border-radius: 10px;
    transition: width 0.5s ease;
}

.dlms-progress-text {
    font-size: 0.85rem;
    color: #777;
    font-weight: 500;
}

.dlms-button-sm {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.95rem;
    align-self: center;
    margin-top: auto;
    text-align: center;
}

.dlms-info-message {
    text-align: center;
    padding: 40px;
    background: var(--dlms-card-bg, #f9f9f9);
    border-radius: 8px;
    color: #666;
}

/* --- Modal Styles --- */
.dlms-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: dlmsFadeIn 0.3s;
}

.dlms-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: dlmsSlideIn 0.3s;
}

.dlms-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.dlms-close:hover,
.dlms-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.dlms-modal-body p {
    margin-bottom: 12px;
    font-size: 1rem;
    color: #333;
}

.dlms-modal-body hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #eee;
}

#dlms-confirm-enroll {
    width: 100%;
    margin-top: 10px;
    background-color: #27ae60;
    border-color: #27ae60;
}

#dlms-confirm-enroll:hover {
    background-color: #219150;
}

@keyframes dlmsFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes dlmsSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Content Protection --- */
body.dlms-protected {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

@media print {
    body.dlms-protected {
        display: none !important;
    }
}

.dlms-status-pending {
    background-color: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ffeeba;
    text-align: center;
    font-weight: bold;
}

.dlms-alert {
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.dlms-alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Single Course Layout - Two Column */
.dlms-course-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}

.dlms-course-main {
    flex: 1;
    min-width: 0;
    /* logic to prevent overflow */
}

.dlms-course-sidebar {
    flex: 0 0 320px;
    max-width: 100%;
}

.dlms-sidebar-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    /* Modern rounding */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    position: sticky;
    top: 40px;
    /* Space from top viewport */
    border: 1px solid #f0f0f0;
}

.dlms-sidebar-thumb img {
    border-radius: 8px;
    margin-bottom: 15px;
    width: 100%;
    height: auto;
    display: block;
}

/* Sidebar Meta Items - Stack them vertically */
.dlms-course-sidebar .dlms-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    border-top: none;
    padding-top: 0;
}

.dlms-course-sidebar .dlms-meta-item {
    font-size: 1rem;
    color: #444;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    justify-content: flex-start;
}

.dlms-course-sidebar .dlms-meta-item:last-child {
    border-bottom: none;
}

/* Curriculum Styling */
.dlms-curriculum {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    margin-top: 30px;
    border: 1px solid #f0f0f0;
}

.dlms-curriculum h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f5f5f5;
    font-size: 1.4rem;
}

.dlms-curriculum ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dlms-curriculum ul li {
    margin-bottom: 10px;
}

.dlms-curriculum ul li a {
    display: block;
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.dlms-curriculum ul li a:hover {
    background: #f0f7fc;
    color: var(--dlms-primary, #0073aa);
    border-left-color: var(--dlms-primary, #0073aa);
    transform: translateX(5px);
}

/* Responsive */
@media (max-width: 768px) {
    .dlms-course-layout {
        flex-direction: column;
    }

    .dlms-course-sidebar {
        flex: auto;
        width: 100%;
    }
}

/* Login Button in Sidebar */
.dlms-login-prompt {
    margin-top: 20px;
    text-align: center;
}

.dlms-button-full {
    display: block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* Quiz Button Spacing */
.dlms-quiz-action {
    margin-top: 30px;
    text-align: center;
    /* Optional: Center the button if not already */
}

/* Remove shadow from quiz button */
.dlms-quiz-action .button {
    box-shadow: none !important;
    border-bottom: none !important;
}

/* Course Description Spacing */
.dlms-course-description {
    margin-top: 30px;
    line-height: 1.6;
    color: #444;
}