/* ==========================================================================
   Admin Styles
   ========================================================================== */

/* Product Files Container */
.product-files-container {
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* File Upload Section */
.file-upload-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-upload-section input[type="file"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.upload-product-files {
    background: #0085ba !important;
    color: #fff !important;
    border-color: #0073aa !important;
}

.upload-product-files:hover {
    background: #0073aa !important;
}

/* Existing Files List */
.existing-files {
    margin-top: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 8px 12px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.file-item:hover {
    background: #f0f0f0;
}

.file-item a {
    flex: 1;
    margin-right: 10px;
    text-decoration: none;
    color: #0073aa;
}

.file-item a:hover {
    color: #00a0d2;
    text-decoration: underline;
}

.file-item .button {
    padding: 0 8px;
    line-height: 26px;
}

/* Variation Files Section */
.variation-files-upload {
    margin: 10px 0;
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 4px;
}

.variation-files-upload label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.existing-variation-files {
    margin-top: 10px;
}

.remove-variation-file,
.remove-product-file {
    background: #dc3232 !important;
    color: #fff !important;
    border-color: #c92424 !important;
}

.remove-variation-file:hover,
.remove-product-file:hover {
    background: #c92424 !important;
}

/* Loading Overlay */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   Frontend Styles
   ========================================================================== */

/* Files List Container */
.product-technical-files,
.variation-technical-files {
    margin: 20px 0;
}

/* Files List */
.technical-files-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.technical-files-list li {
    margin: 8px 0;
}

.technical-file-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: 12px 16px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.technical-file-link:hover {
    background: #f0f0f0;
    border-color: #ccc;
    text-decoration: none;
    transform: translateX(3px);
}

.technical-file-link:before {
    content: "📎";
    margin-right: 8px;
    font-size: 16px;
}

.file-name {
    font-size: 14px;
}

/* Notices */
.technical-files-notice {
    padding: 15px;
    margin: 10px 0;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    color: #666;
}

.technical-files-notice.error {
    background: #fff6f6;
    border-color: #ffc7c7;
    color: #cf0000;
}

/* Loading State */
.loading-files {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading-files:after {
    content: "...";
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0% { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
}

/* Tab Visibility */
.wc-tabs li.technical_files_tab {
    display: none;
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .file-upload-section {
        flex-direction: column;
    }

    .file-upload-section input[type="file"] {
        width: 100%;
        margin-bottom: 10px;
    }

    .file-item {
        flex-direction: column;
        text-align: center;
    }

    .file-item a {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .technical-file-link {
        width: 100%;
        justify-content: center;
    }
}

/* Loading state styles */
.technical-files-loading {
    position: relative;
    min-height: 150px;
}

.technical-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

.technical-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #007cba;
    animation: technical-spin 1s linear infinite;
}

@keyframes technical-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.technical-files-notice {
    padding: 15px;
    margin: 10px 0;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    color: #666;
}

.technical-files-notice.error {
    background: #fff6f6;
    border-color: #ffc7c7;
    color: #cf0000;
}

#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#variable_product_options.loading {
    position: relative;
    pointer-events: none;
}