/**
 * Edmark LMS - Custom Tables Frontend Styles
 * Styling for user-created tables on batch pages
 */

/* Table Wrapper */
.edmark-custom-table-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin: 40px 0;
}

/* Table Header */
.edmark-custom-table-wrapper .custom-table-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.edmark-custom-table-wrapper .custom-table-title {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edmark-custom-table-wrapper .custom-table-title .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.edmark-custom-table-wrapper .custom-table-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

/* Table Container */
.edmark-custom-table-wrapper .custom-table-container {
    overflow-x: auto;
    padding: 0;
}

/* Base Table Styles */
.edmark-custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.edmark-custom-table thead th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #E5E7EB;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.edmark-custom-table tbody td {
    padding: 18px 20px;
    border-bottom: 1px solid #F3F4F6;
    color: #4B5563;
    vertical-align: top;
    line-height: 1.6;
}

.edmark-custom-table tbody tr:hover {
    background: #F9FAFB;
    transition: background 0.2s ease;
}

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

/* Links in table cells */
.edmark-custom-table a {
    color: #2563EB;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.edmark-custom-table a:hover {
    color: #1D4ED8;
    border-bottom-color: #1D4ED8;
}

.edmark-custom-table a:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* External link indicator */
.edmark-custom-table a[target="_blank"]::after {
    content: "↗";
    display: inline-block;
    margin-left: 4px;
    font-size: 0.85em;
    opacity: 0.7;
}

/* Button-style links */
.edmark-custom-table a.button-link {
    display: inline-block;
    padding: 8px 16px;
    background: #2563EB;
    color: #fff !important;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    border: none;
}

.edmark-custom-table a.button-link:hover {
    background: #1D4ED8;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-bottom: none;
}

/* Style Variations */

/* Default Style */
.edmark-custom-table-wrapper.style-default .edmark-custom-table tbody tr:nth-child(even) {
    background: #FAFAFA;
}

/* Striped Style */
.edmark-custom-table-wrapper.style-striped .edmark-custom-table tbody tr:nth-child(odd) {
    background: #F9FAFB;
}

/* Bordered Style */
.edmark-custom-table-wrapper.style-bordered .edmark-custom-table {
    border: 1px solid #E5E7EB;
}

.edmark-custom-table-wrapper.style-bordered .edmark-custom-table th,
.edmark-custom-table-wrapper.style-bordered .edmark-custom-table td {
    border: 1px solid #E5E7EB;
}

/* Minimal Style */
.edmark-custom-table-wrapper.style-minimal .edmark-custom-table thead th {
    border-bottom: 1px solid #E5E7EB;
    background: transparent !important;
}

.edmark-custom-table-wrapper.style-minimal .edmark-custom-table tbody td {
    border-bottom: 1px solid #F3F4F6;
}

.edmark-custom-table-wrapper.style-minimal .edmark-custom-table tbody tr:hover {
    background: transparent;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .edmark-custom-table-wrapper .custom-table-header {
        padding: 24px 20px 16px;
    }
    
    .edmark-custom-table-wrapper .custom-table-title {
        font-size: 20px;
    }
    
    .edmark-custom-table thead th,
    .edmark-custom-table tbody td {
        padding: 14px 16px;
    }
}

@media (max-width: 768px) {
    .edmark-custom-table-wrapper {
        margin: 30px 0;
        border-radius: 8px;
    }
    
    .edmark-custom-table-wrapper .custom-table-header {
        padding: 20px 16px 12px;
    }
    
    .edmark-custom-table-wrapper .custom-table-title {
        font-size: 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .edmark-custom-table-wrapper .custom-table-subtitle {
        font-size: 13px;
    }
    
    /* Make tables scrollable on mobile */
    .edmark-custom-table-wrapper .custom-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .edmark-custom-table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .edmark-custom-table thead th,
    .edmark-custom-table tbody td {
        padding: 12px 12px;
        font-size: 12px;
    }
}

/* Print Styles */
@media print {
    .edmark-custom-table-wrapper {
        box-shadow: none;
        border: 1px solid #E5E7EB;
        page-break-inside: avoid;
    }
    
    .edmark-custom-table tbody tr:hover {
        background: transparent;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edmark-custom-table tbody tr {
    animation: fadeInUp 0.3s ease forwards;
}

.edmark-custom-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.edmark-custom-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.edmark-custom-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.edmark-custom-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.edmark-custom-table tbody tr:nth-child(5) { animation-delay: 0.25s; }

/* Accessibility */
.edmark-custom-table:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Empty State */
.edmark-custom-table-wrapper .no-tables-message {
    padding: 40px;
    text-align: center;
    color: #6B7280;
}

.edmark-custom-table-wrapper .no-tables-message .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #D1D5DB;
    margin-bottom: 10px;
}
