/**
 * Frontend Styles for Product Manuals Manager
 * Designed to work perfectly with Woodmart theme
 *
 * @package Product_Manuals_Manager
 */

/* ==========================================================================
   Product Tab Manuals Display
   ========================================================================== */

.pmm-product-manuals-tab {
    padding: 20px 0;
}

.pmm-widget-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.pmm-widget-subtitle {
    margin: 0 0 14px;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.pmm-manuals-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pmm-manual-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #f8f9fb;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none !important;
    color: inherit !important;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.pmm-manual-row:hover {
    background: #fff;
    border-color: #d0d7de;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.pmm-manual-row:active {
    background: #f0f4f8;
}

.pmm-manual-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: #e8f0fe;
    border-radius: 8px;
    color: #2271b1;
}

.pmm-manual-icon svg {
    width: 18px;
    height: 18px;
}

.pmm-manual-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pmm-manual-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pmm-manual-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #8b949e;
}

.pmm-file-badge {
    display: inline-block;
    padding: 1px 6px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.6;
}

.pmm-file-size {
    color: #8b949e;
}

.pmm-manual-action {
    flex-shrink: 0;
    margin-left: auto;
}

.pmm-download-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #8b949e;
    transition: color 0.2s, background 0.2s;
}

.pmm-download-icon svg {
    width: 18px;
    height: 18px;
}

.pmm-manual-row:hover .pmm-download-icon {
    color: #2271b1;
    background: #e8f0fe;
}

/* ==========================================================================
   Order Item Manuals Display
   ========================================================================== */

.pmm-order-item-manuals {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 3px solid #2271b1;
    border-radius: 4px;
}

.pmm-order-manuals-header {
    margin-bottom: 10px;
}

.pmm-order-manuals-header strong {
    color: #2271b1;
    font-size: 14px;
}

.pmm-order-manuals-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pmm-order-manual-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.pmm-order-manual-item:last-child {
    border-bottom: none;
}

.pmm-order-manual-item svg {
    width: 16px;
    height: 16px;
    color: #d32f2f;
    flex-shrink: 0;
}

.pmm-manual-link {
    color: #2271b1 !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.2s;
}

.pmm-manual-link:hover {
    color: #135e96 !important;
    text-decoration: underline !important;
}

.pmm-manual-size {
    color: #999;
    font-size: 12px;
    margin-left: 5px;
}

/* ==========================================================================
   Manual Search Widget (Elementor)
   ========================================================================== */

.pmm-manual-search-widget {
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}

.pmm-search-title {
    margin: 0 0 15px;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    text-align: center;
}

.pmm-search-description {
    margin: 0 0 30px;
    font-size: 16px;
    color: #666;
    text-align: center;
    line-height: 1.6;
}

.pmm-search-form {
    max-width: 600px;
    margin: 0 auto 30px;
}

.pmm-search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.pmm-search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.pmm-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.1);
}

.pmm-search-button {
    padding: 15px 35px;
    background: linear-gradient(135deg, #2271b1, #135e96);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(34,113,177,0.3);
}

.pmm-search-button:hover {
    background: linear-gradient(135deg, #135e96, #0d4a75);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34,113,177,0.4);
}

.pmm-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.pmm-search-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: pmm-spin 1s linear infinite;
}

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

/* Search Results */
.pmm-search-results {
    margin-top: 30px;
}

.pmm-search-result {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.pmm-search-result:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.pmm-result-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.pmm-result-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.pmm-result-info {
    flex: 1;
}

.pmm-result-title {
    margin: 0 0 5px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.pmm-result-sku {
    margin: 0;
    font-size: 14px;
    color: #999;
}

.pmm-result-sku strong {
    color: #666;
}

.pmm-result-manuals {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.pmm-result-manual {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
}

.pmm-result-manual:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pmm-result-manual-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.pmm-result-manual-size {
    margin: 0 0 15px;
    font-size: 13px;
    color: #999;
}

.pmm-result-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #2271b1;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.pmm-result-download-btn:hover {
    background: #135e96;
}

.pmm-no-results {
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
}

.pmm-error-message {
    padding: 20px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 768px) {
    .pmm-product-manuals-tab {
        padding: 15px 0;
    }
    
    .pmm-manual-row {
        padding: 10px 14px;
        gap: 12px;
    }
    
    .pmm-manual-search-widget {
        padding: 25px 20px;
    }
    
    .pmm-search-title {
        font-size: 24px;
    }
    
    .pmm-search-input-wrapper {
        flex-direction: column;
    }
    
    .pmm-search-button {
        width: 100%;
    }
    
    .pmm-result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pmm-result-manuals {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    .pmm-manual-row {
        padding: 10px 12px;
        gap: 10px;
    }

    .pmm-manual-icon {
        width: 32px;
        height: 32px;
    }

    .pmm-manual-icon svg {
        width: 16px;
        height: 16px;
    }

    .pmm-manual-title {
        font-size: 13px;
    }

    .pmm-order-item-manuals {
        padding: 12px;
    }
}

/* ==========================================================================
   Woodmart Theme Compatibility
   ========================================================================== */

/* Ensure tabs work properly with Woodmart */
.woocommerce-tabs .pmm-product-manuals-tab {
    padding: 20px;
}

body.woodmart-theme .pmm-manual-row {
    font-family: inherit;
}

body.woodmart-theme .pmm-manual-icon {
    background: color-mix(in srgb, var(--wd-primary-color, #2271b1) 15%, transparent);
    color: var(--wd-primary-color, #2271b1);
}

body.woodmart-theme .pmm-file-badge {
    background: color-mix(in srgb, var(--wd-primary-color, #2271b1) 15%, transparent);
    color: var(--wd-primary-color, #2271b1);
}

body.woodmart-theme .pmm-manual-row:hover .pmm-download-icon {
    color: var(--wd-primary-color, #2271b1);
    background: color-mix(in srgb, var(--wd-primary-color, #2271b1) 15%, transparent);
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .pmm-manual-action,
    .pmm-search-button {
        display: none;
    }
    
    .pmm-manual-row {
        border: 1px solid #ccc;
    }

    .pmm-order-item-manuals {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}


