/* WP Digital Download - Admin Styles */

/* Product Metaboxes */
.wpdd-metabox-content {
    padding: 10px 0;
}

.wpdd-metabox-content p {
    margin-bottom: 15px;
}

.wpdd-metabox-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.wpdd-metabox-content input[type="text"],
.wpdd-metabox-content input[type="number"],
.wpdd-metabox-content input[type="email"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wpdd-metabox-content input[type="checkbox"] {
    margin-right: 8px;
}

.wpdd-metabox-content .description {
    font-style: italic;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

/* Price fields toggle */
#wpdd_is_free:checked ~ .wpdd-price-field {
    opacity: 0.5;
    pointer-events: none;
}

/* Files Metabox */
.wpdd-files-container {
    padding: 10px 0;
}

#wpdd-files-list {
    margin-bottom: 20px;
}

.wpdd-file-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    background: #f9f9f9;
}

.wpdd-file-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #f1f1f1;
    border-bottom: 1px solid #ddd;
}

.wpdd-file-handle {
    cursor: move;
    margin-right: 10px;
    color: #666;
}

.wpdd-file-header input[type="text"] {
    flex: 1;
    margin-right: 10px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.wpdd-file-content {
    padding: 15px;
}

.wpdd-file-url {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wpdd-file-url-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wpdd-upload-file,
.wpdd-remove-file {
    white-space: nowrap;
}

.wpdd-remove-file {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.wpdd-remove-file:hover {
    background: #c82333;
}

#wpdd-add-file {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

#wpdd-add-file:hover {
    background: #005a87;
}

/* Settings Grid */
.wpdd-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.wpdd-setting-group {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.wpdd-setting-group h4 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 14px;
    font-weight: 600;
}

.wpdd-setting-group p {
    margin-bottom: 15px;
}

.wpdd-setting-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
}

.wpdd-setting-group input[type="text"],
.wpdd-setting-group input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

.wpdd-setting-group .description {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

@media (max-width: 782px) {
    .wpdd-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Stats Metabox */
.wpdd-stats p {
    margin-bottom: 8px;
    font-size: 13px;
}

.wpdd-stats strong {
    color: #23282d;
}

/* Product List Columns */
.column-wpdd_price,
.column-wpdd_sales,
.column-wpdd_revenue,
.column-wpdd_files {
    width: 10%;
}

/* File Upload Progress */
.wpdd-upload-progress {
    width: 100%;
    height: 20px;
    background: #f1f1f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.wpdd-upload-progress-bar {
    height: 100%;
    background: #0073aa;
    transition: width 0.3s;
    border-radius: 10px;
}

/* Drag and Drop Sorting */
.wpdd-file-item.ui-sortable-helper {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: rotate(2deg);
}

.wpdd-file-item.ui-sortable-placeholder {
    border: 2px dashed #0073aa;
    background: transparent;
}

/* Admin Dashboard Widgets */
.wpdd-sales-summary .wpdd-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.wpdd-sales-summary .wpdd-stat {
    text-align: center;
    padding: 10px;
    background: #f0f0f1;
    border-radius: 4px;
}

.wpdd-sales-summary .wpdd-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: #2271b1;
}

.wpdd-sales-summary .wpdd-stat-label {
    display: block;
    font-size: 12px;
    color: #646970;
    margin-top: 5px;
}

/* Orders Page */
.wpdd-status {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.wpdd-status-completed {
    background: #d4edda;
    color: #155724;
}

.wpdd-status-pending {
    background: #fff3cd;
    color: #856404;
}

.wpdd-status-failed {
    background: #f8d7da;
    color: #721c24;
}

/* Reports Page */
.wpdd-date-filter {
    margin: 20px 0;
}

.wpdd-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.wpdd-stat-box {
    background: white;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wpdd-stat-box h3 {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 14px;
    font-weight: 600;
}

.wpdd-stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #2271b1;
    margin: 0;
    line-height: 1.2;
}

.wpdd-reports-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.wpdd-report-section h2 {
    margin-bottom: 15px;
    font-size: 18px;
}

@media (max-width: 1200px) {
    .wpdd-reports-tables {
        grid-template-columns: 1fr;
    }
}

/* Settings Page */
.wpdd-settings-sidebar {
    float: right;
    width: 300px;
    margin-left: 20px;
}

.wpdd-settings-box {
    background: white;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wpdd-settings-box h3 {
    margin-top: 0;
    font-size: 16px;
}

.wpdd-settings-box code {
    background: #f1f1f1;
    padding: 2px 5px;
    font-size: 12px;
    border-radius: 3px;
}

.wpdd-settings-box ul {
    margin: 0;
    padding-left: 20px;
}

.wpdd-settings-box li {
    margin-bottom: 8px;
    font-size: 13px;
}

.wpdd-status-good {
    color: #46b450;
}

.wpdd-status-warning {
    color: #ffb900;
}

.wpdd-status-error {
    color: #dc3232;
}

#wpforms-settings .form-table {
    max-width: calc(100% - 340px);
}

@media (max-width: 1200px) {
    .wpdd-settings-sidebar {
        float: none;
        width: 100%;
        margin-left: 0;
        margin-top: 30px;
    }
    
    #wpforms-settings .form-table {
        max-width: 100%;
    }
}

/* Responsive adjustments */
@media (max-width: 782px) {
    .wpdd-file-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .wpdd-file-url {
        flex-direction: column;
        gap: 10px;
    }
    
    .wpdd-settings-sidebar {
        width: 100%;
        margin-left: 0;
        margin-top: 20px;
        float: none;
    }
    
    .wpdd-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading states */
.wpdd-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.wpdd-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: wpdd-spin 1s linear infinite;
}

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