/**
 * Frontend styles for Dokan Digital Products
 */

/* Order License Display */
.ddp-order-licenses {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
}

.ddp-order-licenses strong {
    display: block;
    margin-bottom: 10px;
    color: #23282d;
}

.ddp-license-code {
    font-family: monospace;
    font-size: 14px;
    background: #fff;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: inline-block;
    margin-right: 10px;
    user-select: all;
}

.ddp-copy-license,
.ddp-reveal-license {
    font-size: 12px;
    padding: 3px 10px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.ddp-copy-license:hover,
.ddp-reveal-license:hover {
    background: #005a87;
    color: #fff;
}

.ddp-copy-license.copied {
    background: #46b450;
}

/* My Account - Digital Licenses */
.woocommerce-account .ddp-license-code {
    word-break: break-all;
}

.woocommerce-account .ddp-copy-license {
    white-space: nowrap;
}

/* Responsive Table */
@media (max-width: 768px) {
    .woocommerce-account table.shop_table_responsive tbody tr td.ddp-license-code {
        text-align: left;
    }
    
    .woocommerce-account table.shop_table_responsive tbody tr td.ddp-license-code::before {
        content: attr(data-title) ": ";
        font-weight: 700;
        display: inline-block;
        margin-bottom: 5px;
    }
}

/* Vendor Dashboard Styles */
.dokan-dashboard .ddp-dashboard-content {
    padding: 0;
}

.dokan-dashboard .ddp-stats-wrapper {
    margin-bottom: 30px;
}

.dokan-dashboard .ddp-products-wrapper {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dokan-dashboard .ddp-recent-sales {
    background: #fff;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* License Modal in Vendor Dashboard */
.dokan-dashboard .ddp-modal {
    z-index: 999999;
}

.dokan-dashboard .ddp-modal-content {
    max-width: 900px;
}

/* Stats Grid */
.dokan-dashboard .dokan-stats ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dokan-dashboard .dokan-stats li {
    background: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 3px;
    transition: transform 0.2s;
}

.dokan-dashboard .dokan-stats li:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.dokan-dashboard .dokan-stats .title {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dokan-dashboard .dokan-stats .count {
    font-size: 32px;
    font-weight: 600;
    color: #23282d;
    line-height: 1;
}

/* Different colors for different stats */
.dokan-dashboard .dokan-stats .total-licenses .count {
    color: #0073aa;
}

.dokan-dashboard .dokan-stats .available-licenses .count {
    color: #46b450;
}

.dokan-dashboard .dokan-stats .sold-licenses .count {
    color: #dc3232;
}

.dokan-dashboard .dokan-stats .digital-revenue .count {
    color: #f56e28;
    font-size: 24px;
}

/* Product Table Enhancements */
.dokan-dashboard .ddp-products-wrapper table {
    width: 100%;
    margin-top: 15px;
}

.dokan-dashboard .ddp-products-wrapper table th {
    background: #f9f9f9;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.dokan-dashboard .ddp-products-wrapper table td {
    vertical-align: middle;
}

/* Action Buttons */
.dokan-dashboard .ddp-manage-licenses {
    margin-right: 5px;
}

/* Empty State */
.dokan-dashboard .dokan-alert-info {
    background: #f0f8ff;
    border-color: #b8daff;
    color: #004085;
}

.dokan-dashboard .dokan-alert-info a {
    color: #002752;
    font-weight: 600;
}

/* Loading Animation */
.ddp-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.ddp-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: ddp-spin 1s linear infinite;
}

@keyframes ddp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.ddp-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #23282d;
    color: #fff;
    padding: 15px 20px;
    border-radius: 3px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
    z-index: 999999;
    animation: ddp-slide-in 0.3s ease-out;
}

.ddp-toast.success {
    background: #46b450;
}

.ddp-toast.error {
    background: #dc3232;
}

@keyframes ddp-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dokan-dashboard .dokan-stats ul {
        grid-template-columns: 1fr;
    }
    
    .dokan-dashboard .ddp-products-wrapper table {
        font-size: 14px;
    }
    
    .dokan-dashboard .ddp-products-wrapper table th,
    .dokan-dashboard .ddp-products-wrapper table td {
        padding: 8px 5px;
    }
    
    .dokan-dashboard .dokan-btn-sm {
        padding: 3px 8px;
        font-size: 12px;
    }
    
    .ddp-toast {
        left: 20px;
        right: 20px;
        bottom: 10px;
    }
}

/* Product Management Page */
.ddp-product-management {
    background: #fff;
    padding: 20px;
}

.ddp-product-management .dokan-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.ddp-product-management .entry-title {
    margin: 0;
    font-size: 24px;
    color: #23282d;
}

/* Product Info Grid */
.ddp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.ddp-info-item {
    display: flex;
    flex-direction: column;
}

.ddp-info-item strong {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.ddp-info-item span {
    font-size: 18px;
    color: #23282d;
}

.ddp-info-item .ddp-license-count {
    font-size: 24px;
    font-weight: 600;
    color: #0073aa;
}

/* Management Tabs */
.ddp-management-tabs {
    margin-top: 30px;
}

.ddp-management-tabs .dokan-nav-tabs {
    list-style: none;
    margin: 0 0 -1px 0;
    padding: 0;
    display: flex;
    border-bottom: 1px solid #ddd;
}

.ddp-management-tabs .dokan-nav-tabs li {
    margin: 0 5px 0 0;
}

.ddp-management-tabs .dokan-nav-tabs li a {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    transition: all 0.2s;
}

.ddp-management-tabs .dokan-nav-tabs li.active a {
    background: #fff;
    color: #23282d;
    font-weight: 600;
    position: relative;
    top: 1px;
}

.ddp-management-tabs .tab-content {
    border: 1px solid #ddd;
    border-top: none;
    background: #fff;
    padding: 20px;
}

.ddp-management-tabs .tab-pane {
    display: none;
}

.ddp-management-tabs .tab-pane.active {
    display: block;
}

/* Panels */
.ddp-management-tabs .dokan-panel {
    border: none;
    box-shadow: none;
    margin: 0;
}

.ddp-management-tabs .dokan-panel-body {
    padding: 0;
}

/* Forms in Management Page */
.ddp-product-management textarea.dokan-form-control {
    min-height: 200px;
    font-family: monospace;
    font-size: 14px;
}

.ddp-product-management .help-block {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
}

/* License Table */
.ddp-license-list table {
    width: 100%;
    margin-top: 0;
}

.ddp-license-list th {
    background: #f9f9f9;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* Bulk Actions */
.ddp-bulk-actions {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    margin-bottom: 15px;
}

.ddp-bulk-actions label {
    display: flex;
    align-items: center;
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.ddp-bulk-actions input[type="checkbox"] {
    margin-right: 8px;
}

#ddp-bulk-delete-btn {
    margin-left: 15px;
}

#ddp-selected-count {
    margin-left: 15px;
    color: #666;
    font-size: 14px;
}

#ddp-selected-count .count {
    font-weight: 600;
    color: #23282d;
}

/* License checkbox column */
.ddp-license-checkbox {
    width: 30px;
    text-align: center;
}

.ddp-license-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* License status styles */
.ddp-status-available {
    color: #46b450;
    font-weight: 600;
}

.ddp-status-sold {
    color: #dc3232;
    font-weight: 600;
}

/* Sold licenses tab */
.ddp-license-order a {
    color: #0073aa;
    text-decoration: none;
}

.ddp-license-order a:hover {
    text-decoration: underline;
}

/* Notifications */
.ddp-notification {
    margin: 0 0 20px 0;
    padding: 15px;
    border-radius: 3px;
    animation: slideDown 0.3s ease-out;
}

.ddp-notification.dokan-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ddp-notification.dokan-alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .ddp-product-management .dokan-dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ddp-product-management .dokan-dashboard-header .dokan-btn {
        margin-top: 10px;
    }
    
    .ddp-info-grid {
        grid-template-columns: 1fr;
    }
    
    .ddp-management-tabs .dokan-nav-tabs {
        flex-wrap: wrap;
    }
    
    .ddp-management-tabs .dokan-nav-tabs li {
        margin-bottom: 5px;
    }
}

/* Print Styles */
@media print {
    .ddp-copy-license,
    .ddp-reveal-license,
    .ddp-manage-licenses {
        display: none !important;
    }
    
    .ddp-license-code {
        border: 1px solid #000;
        padding: 10px;
        margin: 5px 0;
        display: block;
    }
}

/* Pagination Styles */
.ddp-pagination-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.ddp-pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.ddp-pagination-info {
    color: #666;
    font-size: 14px;
}

.ddp-per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.ddp-per-page-selector label {
    margin: 0;
    color: #666;
}

.ddp-per-page-selector select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    font-size: 14px;
}

.ddp-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ddp-page-link,
.ddp-page-current,
.ddp-page-dots {
    display: inline-block;
    padding: 5px 10px;
    min-width: 35px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.2s;
}

.ddp-page-link {
    color: #0073aa;
    background: #fff;
}

.ddp-page-link:hover {
    background: #f5f5f5;
    border-color: #0073aa;
    color: #005a87;
}

.ddp-page-current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: 600;
}

.ddp-page-dots {
    border: none;
    background: none;
    color: #666;
    cursor: default;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .ddp-pagination-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ddp-pagination {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .ddp-per-page-selector {
        width: 100%;
        justify-content: center;
    }
    
    .ddp-pagination-info {
        width: 100%;
        text-align: center;
    }
}