/* Frontend Styles for WooCommerce Project Files Delivery */

.woocommerce-project-files {
    margin: 20px 0;
}

.woocommerce-project-files h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #7c7c7c;
    padding-bottom: 10px;
}

.project-files-order {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.project-files-order h4 {
    background: #f8f9fa;
    margin: 0;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
}

.order-date {
    font-size: 0.9em;
    color: #666;
    font-weight: normal;
}

.project-files-list {
    padding: 0;
}

.project-file-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

.project-file-item:last-child {
    border-bottom: none;
}

.project-file-item:hover {
    background-color: #f8f9fa;
}

.project-file-item.expired,
.project-file-item.limit-exceeded,
.project-file-item.unavailable {
    opacity: 0.6;
    background-color: #f5f5f5;
}

.file-icon {
    margin-left: 15px;
    color: #666;
    font-size: 1.5em;
}

.file-info {
    flex: 1;
    margin: 0 15px;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 18px;
    
}

.file-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: #666;
}

.file-meta span {
    display: flex;
    align-items: center;
}

.file-meta span:before {
    content: "•";
    margin: 0 5px;
    color: #ccc;
}

.file-meta span:first-child:before {
    display: none;
}

.file-actions {
    margin-right: 15px;
}

.download-btn {
    background: var(--wpf-primary-color, #A8977B);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.download-btn:hover {
    background: var(--wpf-secondary-color, #8B7355);
    color: white;
    text-decoration: none;
}

.download-btn:focus {
    outline: 2px solid #4a4151;
    outline-offset: 2px;
}

.file-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

.file-status.expired {
    background: #f8d7da;
    color: #721c24;
}

.file-status.limit-exceeded {
    background: #fff3cd;
    color: #856404;
}

.file-status.unavailable {
    background: #e2e3e5;
    color: #383d41;
}

.project-files-info {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.project-files-info h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.project-files-info ul {
    margin: 0;
    padding-right: 20px;
}

.project-files-info li {
    margin-bottom: 8px;
    color: #6c757d;
}

/* Loading states */
.downloading {
    position: relative;
    pointer-events: none;
}

.downloading:after {
    content: '';
    position: absolute;
    top: 50%;
    right: 50%;
    width: 16px;
    height: 16px;
    margin: -8px -8px 0 0;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty state */
.woocommerce-message {
    padding: 20px;
    margin: 20px 0;
    border-radius: 6px;
    text-align: center;
}

.woocommerce-message--info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Responsive design */
@media (max-width: 768px) {
    .project-file-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: right;
    }
    
    .file-icon {
        margin: 0 0 10px 0;
        align-self: center;
    }
    
    .file-info {
        margin: 0 0 15px 0;
        width: 100%;
    }
    
    .file-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .file-actions {
        margin: 0;
        align-self: center;
    }
    
    .project-files-order h4 {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .woocommerce-project-files {
        margin: 10px 0;
    }
    
    .project-files-order {
        margin-bottom: 20px;
    }
    
    .project-file-item {
        padding: 12px 15px;
    }
    
    .project-files-order h4 {
        padding: 12px 15px;
        font-size: 1.1em;
    }
    
    .project-files-info {
        padding: 15px;
        margin-top: 20px;
    }
}

/* RTL Support */
body.rtl .project-file-item {
    direction: rtl;
}

body.rtl .file-icon {
    margin-right: 15px;
    margin-left: 0;
}

body.rtl .file-info {
    text-align: right;
}

body.rtl .file-actions {
    margin-left: 15px;
    margin-right: 0;
}

body.rtl .project-files-info ul {
    padding-left: 20px;
    padding-right: 0;
}

/* Accessibility improvements */
.download-btn:focus,
.file-status:focus {
    outline: 2px solid #4a4151;
    outline-offset: 2px;
}

.project-file-item:focus-within {
    background-color: #f0f8ff;
    outline: 1px solid #7c7c7c;
}

/* Print styles */
@media print {
    .download-btn,
    .file-actions {
        display: none;
    }
    
    .project-files-order {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .project-file-item {
        border-bottom: 1px solid #ccc;
    }
}
