/* Premium CSS for Redesigned Training Certificate Printing (A4 Portrait) */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

/* Hide print templates on screen */
#certificate-print-template {
    display: none;
}

.cert-card {
    width: 210mm;
    height: 297mm;
    background: #ffffff;
    box-sizing: border-box;
    padding: 10mm;
    position: relative;
    border: 10px solid;
    border-image: linear-gradient(135deg, #1b75bb 0%, #10b981 100%) 1;
    font-family: 'Inter', 'Cairo', sans-serif;
    color: #1e293b;
    display: flex;
    flex-direction: column;
}

.cert-inner-border {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 5px solid #1b75bb; /* Dark blue/teal border */
    padding: 10mm; /* 1cm margin from all sides */
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
}

/* Header styling */
.cert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 0;
}

.header-left {
    display: flex;
    align-items: center;
}

.cert-logo-top {
    height: 15mm; /* Reduced size slightly to 15mm */
    width: auto;
    object-fit: contain;
}

.header-divider {
    width: 1px;
    height: 13mm; /* Reduced divider height accordingly */
    background-color: #cbd5e1;
    margin: 0 15px;
}

.header-right {
    display: flex;
    align-items: center;
}

.cert-title-img-top {
    height: 15mm; /* Reduced size slightly to 15mm */
    width: auto;
    object-fit: contain;
}

/* Titles section */
.cert-title-section {
    text-align: center;
    margin-top: 12mm;
}

.cert-main-title {
    font-size: 44px;
    font-weight: 800;
    color: #1b75bb;
    letter-spacing: 5px;
    margin: 0;
}

.cert-sub-title {
    font-size: 20px;
    font-weight: 600;
    color: #0284c7;
    margin-top: 2mm;
    margin-bottom: 0;
}

/* Presentation and student details */
.cert-presentation {
    text-align: center;
    margin-top: 12mm;
    width: 100%;
}

.cert-presentation-text {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 2px;
}

.cert-student-name {
    font-family: 'Cairo', 'Inter', sans-serif;
    font-size: 40px;
    font-weight: 800;
    color: #0891b2;
    margin: 5mm 0;
    direction: rtl; /* displays Arabic beautifully */
}

.cert-completion-text {
    font-size: 15px;
    color: #64748b;
}

/* Course details */
.cert-course-section {
    text-align: center;
    margin-top: 6mm;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cert-course-title {
    font-family: 'Cairo', 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
    max-width: 85%;
    line-height: 1.4;
    direction: rtl;
}

.cert-course-desc {
    font-family: 'Cairo', 'Inter', sans-serif;
    font-size: 16px;
    color: #475569;
    font-weight: 500;
    margin-top: 2mm;
    max-width: 80%;
    direction: rtl;
}

.cert-details-section {
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    margin-top: 10mm;
    text-align: center;
}

/* Bottom Ribbon */
.bottom-ribbon {
    position: absolute;
    bottom: 35mm;
    left: 0;
    right: 0;
    height: 30mm;
    background: linear-gradient(90deg, #1b75bb 0%, #10b981 100%);
    overflow: hidden;
    z-index: 1;
}

.ribbon-circle {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.circle-1 { width: 25mm; height: 25mm; left: 5mm; top: -3mm; }
.circle-2 { width: 35mm; height: 35mm; left: 25mm; top: -10mm; }
.circle-3 { width: 20mm; height: 20mm; left: 55mm; top: 10mm; }
.circle-4 { width: 30mm; height: 30mm; left: -5mm; top: 12mm; }

/* Signature section */
.cert-signature-section {
    position: absolute;
    bottom: 42mm;
    left: 18mm;
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.signature-img {
    height: 22mm;
    width: auto;
    object-fit: contain;
    margin-bottom: -2mm;
}

.signature-line {
    width: 60mm;
    border-top: 1.5px solid #1e293b;
    margin-bottom: 2mm;
}

.signature-name {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
}

.signature-title {
    font-size: 11px;
    color: #64748b;
    margin-top: 1mm;
    font-weight: 500;
}

/* Badge seal section */
.cert-badge-img {
    position: absolute;
    bottom: 28mm; /* Moved up from 20mm */
    right: 14mm;
    width: 64mm; /* Increased size from 52mm */
    height: auto;
    object-fit: contain;
    z-index: 10;
    filter: drop-shadow(0px 6px 12px rgba(0,0,0,0.15));
}

/* Tiny metadata styling at very bottom */
.cert-verification-meta {
    position: absolute;
    bottom: 5mm;
    width: calc(100% - 20mm);
    text-align: center;
    font-size: 9px;
    color: #94a3b8;
    direction: ltr;
}

/* Screen print overrides to avoid layouts leaking to dashboard */
@media print {
    body > *:not(#print-area) {
        display: none !important;
    }
    #print-area {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        padding: 0;
        width: 297mm;
        height: 210mm;
    }
}

/* ==========================================
   Premium Table Styling for Courses & Certs
   ========================================== */
.fin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 15px 0;
    font-size: 14px;
    text-align: right;
    direction: rtl;
}

.fin-table th {
    background-color: var(--remind-blue, #1b8fa6);
    color: white;
    font-weight: 700;
    padding: 14px 16px;
    border: none;
    text-transform: uppercase;
}

/* Rounded corners for the table headers */
.fin-table th:first-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.fin-table th:last-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.fin-table td {
    padding: 14px 16px;
    color: var(--text-primary, #1e293b);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    font-weight: 500;
    vertical-align: middle;
}

.fin-table tbody tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.fin-table tbody tr:hover {
    background-color: rgba(27, 143, 166, 0.04);
}

.fin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Action buttons inside table */
.fin-table button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    outline: none;
}

.fin-table button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.fin-table button.print-btn {
    color: var(--remind-blue, #1b8fa6);
    margin-left: 8px;
}

.fin-table button.print-btn:hover {
    background-color: rgba(27, 143, 166, 0.1);
    border-color: rgba(27, 143, 166, 0.2);
}

.fin-table button.download-btn {
    color: #10b981;
    margin-left: 8px;
}

.fin-table button.download-btn:hover {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.fin-table button.share-btn {
    color: #6366f1;
    margin-left: 8px;
}

.fin-table button.share-btn:hover {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

.fin-table button.view-btn {
    color: #0284c7;
    margin-left: 8px;
}

.fin-table button.view-btn:hover {
    background-color: rgba(2, 132, 199, 0.1);
    border-color: rgba(2, 132, 199, 0.2);
}

.fin-table button.edit-btn {
    color: #d97706; /* premium amber */
    margin-left: 8px;
}

.fin-table button.edit-btn:hover {
    background-color: #fef3c7;
    border-color: #fde68a;
}

.fin-table button.delete-btn {
    color: #ef4444;
}

.fin-table button.delete-btn:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
}

/* Responsive wrapper */
.table-responsive-premium {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: white;
    padding: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* ==========================================
   Responsive Grid & Flex Classes
   ========================================== */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.cert-issue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* ==========================================
   Media Queries for Mobile & Tablet
   ========================================== */
@media (max-width: 768px) {
    .cert-issue-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .cert-issue-grid button {
        width: 100%;
        margin-top: 5px;
        height: 48px;
    }
}

.training-header-banner {
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(27, 143, 166, 0.08), rgba(99, 102, 241, 0.04));
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 18px 25px;
    flex-wrap: wrap;
    gap: 15px;
    direction: rtl;
    box-sizing: border-box;
}

.training-header-banner .banner-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.training-header-banner .banner-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(27, 143, 166, 0.12);
    color: var(--remind-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.training-header-banner .banner-text-info h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--text-primary);
}

.training-header-banner .banner-text-info p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.training-tabs-nav {
    display: flex;
    background: var(--bg-elevated, #f1f5f9);
    border: 1px solid var(--border-subtle, #e2e8f0);
    padding: 5px;
    border-radius: 16px;
    gap: 5px;
}

.training-tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.training-tab-btn:hover {
    color: var(--text-primary, #1e293b);
    background: rgba(0, 0, 0, 0.03);
}

.training-tab-btn.active {
    background: var(--remind-blue, #1b8fa6) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(27, 143, 166, 0.2);
}

body.dark-mode .training-tabs-nav {
    background: var(--bg-elevated, #1e293b) !important;
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
}

body.dark-mode .training-tab-btn {
    color: var(--text-muted, #94a3b8);
}

body.dark-mode .training-tab-btn:hover {
    color: var(--text-primary, #f8fafc);
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .training-tab-btn.active {
    background: var(--remind-blue, #1b8fa6) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(27, 143, 166, 0.3);
}

.training-stats-grid {
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.training-stats-grid .card {
    margin-bottom: 0 !important;
    padding: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.training-stats-grid .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.training-stats-grid .stat-icon-wrapper {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.training-stats-grid .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 800;
}

.training-stats-grid .stat-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-primary);
    margin-top: 2px;
}

.training-split-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 25px;
    margin-bottom: 25px;
}

.training-card {
    padding: 25px;
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.training-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.training-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-cert-preview-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 20px;
    overflow: hidden;
    position: relative;
    min-height: 270px;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    gap: 15px;
}

.mini-cert-preview-card .preview-title {
    width: 100%;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    text-align: right;
    display: flex;
    align-items: center;
    gap: 6px;
    direction: rtl;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
    margin-bottom: 5px;
}

#mini-cert-preview {
    width: 100%;
    aspect-ratio: 297 / 210;
    border: 3px double var(--border-medium);
    background: #fdfcfa;
    padding: 4% 5%;
    border-radius: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #1d1b2a;
    font-family: 'Cinzel', 'Cairo', serif;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    container-type: inline-size;
}

#mini-cert-preview .cert-org {
    font-size: 2.2cqw;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6b6b6b;
    font-weight: 600;
    margin-bottom: 1%;
}

#mini-cert-preview .cert-main-title {
    font-size: 3.2cqw;
    font-weight: 800;
    color: #0d1b2a;
    text-transform: uppercase;
    margin-bottom: 1.5%;
    letter-spacing: 0.1em;
}

#mini-cert-preview .cert-line-divider {
    width: 12%;
    height: 1.5px;
    background: #1b8fa6;
    margin: 1.5% 0 2.5%;
}

#mini-cert-preview .cert-presentation-label {
    font-size: 1.8cqw;
    color: #6b6b6b;
    text-transform: uppercase;
    margin-bottom: 1%;
}

#mini-cert-preview #preview-student-name {
    font-size: 4.5cqw;
    font-weight: 800;
    color: #1b8fa6;
    margin: 1.5% 0;
    min-height: 1.2em;
    direction: rtl;
}

#mini-cert-preview .cert-completion-label {
    font-size: 1.8cqw;
    color: #6b6b6b;
    margin-bottom: 1%;
}

#mini-cert-preview #preview-course-name {
    font-size: 2.8cqw;
    font-weight: 700;
    color: #0d1b2a;
    min-height: 1.2em;
    max-width: 90%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    direction: rtl;
}

/* ============================================================
   RESPONSIVE LAYOUT MEDIA QUERIES (From Laptop to Mobile)
   ============================================================ */

@media (max-width: 1200px) {
    .training-stats-grid {
        gap: 15px;
    }
    .training-stats-grid .card {
        padding: 15px;
        gap: 10px;
    }
}

@media (max-width: 992px) {
    .training-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .training-stats-grid .card:last-child {
        grid-column: span 2;
    }
    
    .training-split-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .training-header-banner {
        padding: 15px 20px;
        border-radius: 20px;
    }
    .training-header-banner .banner-text-info h2 {
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .training-header-banner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
        padding: 20px 15px;
    }
    
    .training-header-banner .banner-title-area {
        flex-direction: column;
        gap: 10px;
    }
    
    .training-header-banner .training-tabs-nav {
        width: 100%;
        justify-content: center;
    }
    
    .training-header-banner .training-tab-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 15px;
        font-size: 12px;
    }

    .training-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .training-stats-grid .card:last-child {
        grid-column: span 1;
    }
    .training-stats-grid .card {
        padding: 15px;
        border-radius: 16px;
    }
    .training-stats-grid .stat-value {
        font-size: 18px;
    }

    .training-card {
        padding: 18px 15px;
        border-radius: 20px;
    }
    
    .training-card-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 15px;
    }
    
    .training-card-header h3 {
        justify-content: center;
        font-size: 14px;
    }
    
    .training-card-header button,
    .training-card-header .search-wrap {
        width: 100% !important;
    }
    
    .mini-cert-preview-card {
        padding: 20px 12px;
        border-radius: 20px;
        min-height: auto;
    }
}

/* ==========================================
   Dark Mode Support overrides
   ========================================== */
body.dark-mode .table-responsive-premium {
    background: var(--bg-surface, #1e293b) !important;
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.06)) !important;
    box-shadow: var(--shadow-lg) !important;
}

body.dark-mode .fin-table td {
    color: var(--text-primary, #f8fafc) !important;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06)) !important;
}

body.dark-mode .fin-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

body.dark-mode .fin-table button {
    background: var(--bg-elevated, #334155) !important;
    border-color: var(--border-medium, rgba(255, 255, 255, 0.1)) !important;
    color: var(--text-primary, #f8fafc) !important;
}

body.dark-mode .fin-table button:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.05)) !important;
    border-color: var(--border-strong, rgba(255, 255, 255, 0.2)) !important;
}

body.dark-mode .fin-table button.print-btn {
    color: var(--gold-light, #2aafc8) !important;
}
body.dark-mode .fin-table button.print-btn:hover {
    background-color: rgba(42, 175, 200, 0.15) !important;
    border-color: rgba(42, 175, 200, 0.3) !important;
}

body.dark-mode .fin-table button.download-btn {
    color: #34d399 !important;
}
body.dark-mode .fin-table button.download-btn:hover {
    background-color: rgba(52, 211, 153, 0.15) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
}

body.dark-mode .fin-table button.share-btn {
    color: #818cf8 !important;
}
body.dark-mode .fin-table button.share-btn:hover {
    background-color: rgba(129, 140, 248, 0.15) !important;
    border-color: rgba(129, 140, 248, 0.3) !important;
}

body.dark-mode .fin-table button.view-btn {
    color: #38bdf8 !important;
}
body.dark-mode .fin-table button.view-btn:hover {
    background-color: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
}

body.dark-mode .fin-table button.edit-btn {
    color: #fbbf24; /* lighter yellow for dark mode contrast */
}
body.dark-mode .fin-table button.edit-btn:hover {
    background-color: rgba(251, 191, 36, 0.15) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

body.dark-mode .fin-table button.delete-btn {
    color: #f87171; /* lighter red */
}
body.dark-mode .fin-table button.delete-btn:hover {
    background-color: rgba(248, 113, 113, 0.15) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
}

/* Custom white elements in Dark Mode */
body.dark-mode #p-training h2 i.fa-graduation-cap {
    color: #ffffff !important;
}

body.dark-mode #p-training .card h3 {
    color: #ffffff !important;
}

body.dark-mode .th-tab-btn.active {
    color: #ffffff !important;
}

/* Actions Dropdown inside Table */
.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0; /* Align to right for RTL layout */
    background-color: var(--bg-surface, #ffffff);
    min-width: 140px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: 10px;
    z-index: 999;
    padding: 6px 0;
    margin-top: 4px;
    text-align: right;
}

.actions-dropdown-menu.show {
    display: block;
    animation: dropdownSlideDown 0.15s ease-out;
}

@keyframes dropdownSlideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.actions-dropdown-menu button {
    width: 100% !important;
    height: auto !important;
    padding: 10px 14px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: var(--text-primary, #1e293b) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    justify-content: flex-start !important;
    direction: rtl !important;
    box-shadow: none !important;
}

.actions-dropdown-menu button:hover {
    background-color: var(--bg-elevated, #f1f5f9) !important;
    transform: none !important;
}

.actions-dropdown-menu button.delete-item {
    color: #ef4444 !important;
}

.actions-dropdown-menu button.delete-item:hover {
    background-color: #fee2e2 !important;
}

body.dark-mode .actions-dropdown-menu {
    background-color: var(--bg-surface, #1e293b) !important;
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
}

body.dark-mode .actions-dropdown-menu button {
    color: var(--text-primary, #f8fafc) !important;
}

body.dark-mode .actions-dropdown-menu button:hover {
    background-color: var(--bg-elevated, rgba(255, 255, 255, 0.03)) !important;
}

body.dark-mode .actions-dropdown-menu button.delete-item:hover {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
}

/* ============================================================
   RESPONSIVE TABLE-TO-CARD STYLING (FOR MOBILE VIEWPORTS)
   ============================================================ */
@media (max-width: 768px) {
    #p-training .table-responsive-premium {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        overflow-x: visible !important;
    }

    #p-training .fin-table {
        border-collapse: collapse !important;
        margin: 0 !important;
    }

    #p-training .fin-table thead {
        display: none !important;
    }
    
    #p-training .fin-table, 
    #p-training .fin-table tbody, 
    #p-training .fin-table tr {
        display: block !important;
        width: 100% !important;
    }
    
    #p-training .fin-table tbody tr {
        background: var(--bg-surface) !important;
        border: 1px solid var(--border-subtle) !important;
        border-radius: 20px !important;
        padding: 16px !important;
        margin-bottom: 15px !important;
        box-shadow: var(--shadow-sm) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        box-sizing: border-box !important;
        transition: all 0.3s ease !important;
    }

    #p-training .fin-table tbody tr:hover {
        transform: translateY(-2px) !important;
        box-shadow: var(--shadow-md) !important;
    }
    
    #p-training .fin-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid var(--border-subtle) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        direction: rtl !important;
        font-size: 13px !important;
        color: var(--text-primary) !important;
        text-align: right !important;
    }
    
    #p-training .fin-table td:last-child {
        border-bottom: none !important;
        padding-top: 12px !important;
    }
    
    #p-training .fin-table td::before {
        content: attr(data-label) ":";
        font-weight: 800;
        color: var(--text-muted);
        font-size: 12px;
        margin-left: 10px;
    }

    #p-training .fin-table td[data-label="خيارات"] {
        justify-content: space-between !important;
    }

    /* Options buttons positioning inside the mobile card */
    #p-training .fin-table td[data-label="خيارات"] button,
    #p-training .fin-table td[data-label="خيارات"] .actions-dropdown {
        margin-left: 4px !important;
    }
}
