/* Accordion Tab Super Maker - Frontend Styles */

/* Global image constraint */
.atsm-tabs-container img,
.atsm-tabs-content img,
.atsm-faq-accordion img,
.atsm-specification-rows img {
    max-width: 480px;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
}

.atsm-tabs-container {
    width: 100%;
    margin: 20px 0;
    font-family: Arial, sans-serif;
}

.atsm-tabs-header {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 0;
    overflow-x: auto;
}

.atsm-tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
}

.atsm-tab-button:hover {
    color: #333;
    background-color: #f8f9fa;
}

.atsm-tab-button.active {
    color: purple;
    border-bottom-color: purple;
    background-color: #f8f9fa;
}

.atsm-tabs-content {
    min-height: 200px;
    padding: 0 0 20px;
}

/* ============================================= */
/* Side tab positioning (left / right vertical)  */
/* ============================================= */
.atsm-tabs-side {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}
.atsm-tabs-side.atsm-tabs-pos-right {
    flex-direction: row-reverse;
}
.atsm-tabs-side .atsm-tabs-header {
    flex: 0 0 auto;
    flex-direction: column;
    border-bottom: none;
    margin-bottom: 0;
    overflow-x: visible;
    align-self: stretch;
}
.atsm-tabs-side.atsm-tabs-pos-left .atsm-tabs-header {
    border-right: 2px solid #e0e0e0;
    padding-right: 16px;
}
.atsm-tabs-side.atsm-tabs-pos-right .atsm-tabs-header {
    border-left: 2px solid #e0e0e0;
    padding-left: 16px;
}
.atsm-tabs-side .atsm-tabs-header .atsm-tab-button {
    width: 100%;
    text-align: left;
    white-space: nowrap;
}
.atsm-tabs-side .atsm-tabs-content {
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 768px) {
    /* Collapse side layout back to stacked on small screens */
    .atsm-tabs-side,
    .atsm-tabs-side.atsm-tabs-pos-right {
        flex-direction: column;
        gap: 0;
    }
    .atsm-tabs-side .atsm-tabs-header {
        border-right: none;
        border-left: none;
        padding-right: 0;
        padding-left: 0;
    }
}

/* Tables Styles */
.atsm-specification-rows {
    width: 100%;
}

.atsm-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.atsm-search-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.atsm-search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.atsm-clear-search {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.atsm-clear-search:hover {
    background-color: #5a6268;
}

.atsm-column-selector {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.atsm-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.atsm-data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.atsm-data-table th,
.atsm-data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.atsm-data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.atsm-data-table tr:hover {
    background-color: #f8f9fa;
}

.atsm-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.atsm-sortable-header:hover {
    background-color: #e9ecef;
}

.atsm-sort-icon {
    margin-left: 5px;
    font-size: 12px;
    color: #666;
}

/* Table Cell with Accordion */
.atsm-table-cell {
    position: relative;
}

.atsm-cell-content {
    display: flex;
    align-items: center;
    gap: 5px;
}

.atsm-cell-content.has-accordion {
    cursor: pointer;
    transition: all 0.2s ease;
}

.atsm-cell-content.has-accordion:hover {
    background-color: #e3f2fd;
    border-radius: 3px;
    padding: 2px 4px;
}

.atsm-accordion-indicator {
    color: #28a745;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.atsm-accordion-indicator.open {
    color: #dc3545;
    transform: rotate(180deg);
}

.atsm-accordion-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 15px;
    margin-top: 5px;
    animation: slideDown 0.3s ease;
}

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

/* Pagination */
.atsm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 20px 0;
}

.atsm-pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.atsm-pagination-btn:hover {
    background-color: #f8f9fa;
}

.atsm-pagination-btn.active {
    background-color: purple;
    color: white;
    border-color: purple;
}

.atsm-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Export Buttons */
.atsm-export-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.atsm-export-btn {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.atsm-export-btn:hover {
    background-color: #005a87;
    transform: translateY(-1px);
}

/* FAQ Accordion */
.atsm-faq-accordion,
.atsm-faq-content {
    width: 100%;
}

.atsm-faq-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.atsm-faq-question {
    width: 100%;
    background-color: #f8f9fa;
    border: none;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
}

.atsm-faq-question:hover {
    background-color: #e9ecef;
}

.atsm-faq-question:after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    transition: transform 0.3s ease;
}

.atsm-faq-question.open:after {
    transform: translateY(-50%) rotate(45deg);
}

.atsm-faq-answer {
    padding: 20px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    animation: slideDown 0.3s ease;
}

/* YouTube Videos */
.atsm-youtube-video,
.atsm-youtube-video-container {
    margin: 10px 0;
    text-align: center;
}

.atsm-youtube-video iframe,
.atsm-youtube-video-container iframe {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.atsm-youtube-error {
    color: #dc3545;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* MP4 Videos */
.atsm-mp4-video {
    margin: 10px 0;
    text-align: center;
}

.atsm-mp4-video video {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Download Items */
.atsm-download-items {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.atsm-download-item {
    margin-bottom: 15px;
    width: 100%;
}

.atsm-download-link {
    display: block !important;
    width: 100% !important;
    padding: 15px 20px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-weight: bold !important;
    font-size: 16px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15) !important;
    border: none !important;
    cursor: pointer !important;
}

.atsm-download-link:hover {
    opacity: 0.9 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 12px rgba(0,0,0,0.25) !important;
}

.atsm-download-items-preview {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.atsm-download-items-preview .atsm-download-item {
    margin-bottom: 15px;
    width: 100%;
}

.atsm-download-items-preview .atsm-download-link {
    display: block !important;
    width: 100% !important;
    padding: 15px 20px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-weight: bold !important;
    font-size: 16px !important;
    text-align: center !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15) !important;
    border: none !important;
    cursor: pointer !important;
}

.atsm-download-items-preview .atsm-download-link:hover {
    opacity: 0.9 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 12px rgba(0,0,0,0.25) !important;
}

/* Images */
.atsm-images,
.atsm-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px auto;
    justify-items: center;
}

.atsm-image,
.atsm-gallery-image,
.atsm-content-image {
    max-width: 480px;
    width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.atsm-image:hover,
.atsm-gallery-image:hover,
.atsm-content-image:hover {
    transform: scale(1.02);
}

/* Image and Text */
.atsm-image-and-text,
.atsm-image-text-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin: 20px auto;
    justify-content: center;
}

.atsm-image-and-text .atsm-image,
.atsm-image-text-content .atsm-content-image {
    max-width: 480px;
    flex-shrink: 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.atsm-text,
.atsm-content-text {
    flex: 1;
    line-height: 1.6;
}

/* Text/HTML/PHP */
.atsm-text-html-php,
.atsm-php-html-text-content {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 4px;
    line-height: 1.6;
}

/* Download Items */
.atsm-download-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.atsm-download-item {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #0073aa;
}

.atsm-download-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.atsm-download-link:hover {
    color: #005a87;
    text-decoration: underline;
}

.atsm-download-link:before {
    content: '📥';
    font-size: 16px;
}

/* YouTube Video */
.atsm-youtube-video {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin: 20px 0;
}

.atsm-youtube-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* MP4 Video */
.atsm-mp4-video {
    margin: 20px 0;
}

.atsm-mp4-video video {
    width: 100%;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* WooCommerce Content */
.atsm-woocommerce-content {
    margin: 20px 0;
}

.atsm-product-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.atsm-product-link:hover {
    background-color: #005a87;
    transform: translateY(-1px);
}

.atsm-product-link:before {
    content: '🛒';
    font-size: 16px;
}

/* Loading States */
.atsm-loading,
.atsm-content-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.atsm-loading:before,
.atsm-content-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.atsm-error {
    padding: 20px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}

.atsm-no-content {
    padding: 40px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Additional Tab Navigation Styles for Preview */
.atsm-tab-navigation {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.atsm-tab-navigation .atsm-tab-button {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    border-radius: 5px 5px 0 0;
    margin-right: 2px;
    transition: all 0.3s ease;
}

.atsm-tab-navigation .atsm-tab-button:hover {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .atsm-tabs-header {
        flex-direction: column;
        border-bottom: none;
    }
    
    .atsm-tab-button {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #e0e0e0;
        border-right: none;
        border-radius: 0;
        margin-right: 0;
        margin-bottom: 2px;
    }
    
    .atsm-tab-button:last-child {
        margin-bottom: 0;
    }
    
    .atsm-tab-button.active {
        border-bottom-color: purple;
        border-left: 4px solid purple;
    }
    
    /* Responsive styles for preview tab navigation */
    .atsm-tab-navigation {
        flex-direction: column;
        border-bottom: none;
        overflow-x: visible;
    }
    
    .atsm-tab-navigation .atsm-tab-button {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #e0e0e0;
        border-right: none;
        border-radius: 0;
        margin-right: 0;
        margin-bottom: 2px;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .atsm-tab-navigation .atsm-tab-button:last-child {
        margin-bottom: 0;
    }
    
    .atsm-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .atsm-search-container {
        justify-content: center;
    }
    
    .atsm-image-and-text,
    .atsm-image-text-content {
        flex-direction: column;
    }
    
    .atsm-image-and-text .atsm-image,
    .atsm-image-text-content .atsm-content-image {
        max-width: 100%;
    }
    
    .atsm-images,
    .atsm-image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .atsm-export-buttons {
        flex-direction: column;
    }
    
    .atsm-accordion-content {
        position: static;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .atsm-tab-button {
        padding: 12px 15px;
        font-size: 14px;
        min-width: auto;
    }
    
    .atsm-tabs-header {
        margin-bottom: 15px;
    }
    
    .atsm-tabs-content {
        padding: 15px 0;
    }
    
    /* Additional responsive styles for very small screens */
    .atsm-tab-navigation .atsm-tab-button {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .atsm-data-table th,
    .atsm-data-table td {
        padding: 8px;
        font-size: 14px;
    }
    
    .atsm-faq-question {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .atsm-faq-answer {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .atsm-tabs-header {
        display: none;
    }
    
    .atsm-controls,
    .atsm-pagination,
    .atsm-export-buttons {
        display: none;
    }
    
    .atsm-accordion-content {
        position: static;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .atsm-data-table {
        box-shadow: none;
    }
    
    .atsm-tabs-content {
        padding: 0;
    }
}
