/* Advanced Documents for WooCommerce - Frontend Styles */

.woocommerce-tabs .adwc-documents-tab {
    font-family: inherit;
}

.adwc-documents-search {
    margin-bottom: 20px;
}

.adwc-search-input {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.adwc-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.adwc-document-category {
    margin-bottom: 30px;
}

.adwc-category-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 15px 0;
    padding: 12px 0;
    border-bottom: 2px solid #f0f0f0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.adwc-category-toggle:hover {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.adwc-toggle-icon {
    font-weight: bold;
    font-size: 20px;
    width: 25px;
    text-align: center;
    color: #0073aa;
}

.adwc-category-count {
    background: #f0f8ff;
    color: #0073aa;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 15px;
    border: 1px solid #e0f2ff;
}

.adwc-documents-list {
    display: grid;
    gap: 20px;
}

.adwc-document-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.adwc-document-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #0073aa;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.adwc-document-item:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.1);
    transform: translateY(-2px);
}

.adwc-document-item:hover::before {
    opacity: 1;
}

.adwc-document-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #f0f8ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0f2ff;
}

.adwc-document-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #0073aa;
}

.adwc-document-info {
    flex-grow: 1;
    min-width: 0;
}

.adwc-document-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.adwc-document-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.adwc-document-title a:hover {
    color: #0073aa;
}

.adwc-document-version {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.adwc-document-description {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 15px;
    line-height: 1.5;
}

.adwc-document-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: #888;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.adwc-document-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.adwc-document-meta .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.adwc-file-type {
    background: #f8f9fa;
    color: #495057;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid #e9ecef;
}

.adwc-download-count {
    color: #28a745;
    font-weight: 500;
}

.adwc-document-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.adwc-download-btn,
.adwc-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.adwc-download-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: 1px solid #28a745;
}

.adwc-download-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea87a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    color: white;
    text-decoration: none;
}

.adwc-preview-btn {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.adwc-preview-btn:hover {
    background: #e9ecef;
    color: #495057;
    border-color: #adb5bd;
    text-decoration: none;
    transform: translateY(-1px);
}

.adwc-download-btn .dashicons,
.adwc-preview-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.adwc-documents-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.adwc-help-text {
    color: #666;
    font-size: 14px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.adwc-help-text .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #0073aa;
    flex-shrink: 0;
}

/* Loading states */
.adwc-download-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.adwc-download-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* Empty state */
.adwc-no-documents {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
}

/* Responsive design */
@media (max-width: 768px) {
    .adwc-document-item {
        flex-direction: column;
        gap: 15px;
        text-align: left;
    }
    
    .adwc-document-actions {
        flex-direction: row;
        align-self: stretch;
    }
    
    .adwc-document-actions .adwc-download-btn,
    .adwc-document-actions .adwc-preview-btn {
        flex: 1;
        text-align: center;
    }
    
    .adwc-document-meta {
        gap: 15px;
        justify-content: flex-start;
    }
    
    .adwc-category-toggle {
        font-size: 16px;
        flex-wrap: wrap;
    }
    
    .adwc-search-input {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .adwc-document-item {
        padding: 15px;
    }
    
    .adwc-document-title {
        font-size: 16px;
    }
    
    .adwc-document-actions {
        flex-direction: column;
    }
    
    .adwc-document-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* WooCommerce integration */
.woocommerce div.product .woocommerce-tabs ul.tabs li.adwc_documents_tab a {
    color: inherit;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.adwc_documents_tab.active a {
    color: #0073aa;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .adwc-document-item {
        background: #1a1a1a;
        border-color: #333;
        color: #fff;
    }
    
    .adwc-document-title a {
        color: #fff;
    }
    
    .adwc-document-description {
        color: #ccc;
    }
    
    .adwc-document-meta {
        color: #999;
    }
    
    .adwc-document-icon {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .adwc-search-input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .adwc-help-text {
        background: #2a2a2a;
        color: #ccc;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .adwc-document-item {
        border-width: 2px;
    }
    
    .adwc-download-btn,
    .adwc-preview-btn {
        border-width: 2px;
    }
    
    .adwc-document-item:hover {
        border-width: 3px;
    }
}

/* Print styles */
@media print {
    .adwc-document-actions {
        display: none;
    }
    
    .adwc-documents-search {
        display: none;
    }
    
    .adwc-document-item {
        border: 1px solid #000;
        break-inside: avoid;
    }
}