/* 
  Hunyuan 3D Plugin - Comprehensive Styles
  This CSS file contains all styles for the plugin's frontend and backend interfaces.
*/

/* ==========================================================================
   Global Styles
   ========================================================================== */

.hunyuan3d-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

.hunyuan3d-container * {
    box-sizing: border-box;
}

/* Full-width page overrides for WordPress themes */
.hunyuan3d-full-width {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    max-width: none !important;
    position: relative;
}

/* Enhanced breakout helpers */
.hunyuan3d-breakout,
.hunyuan3d-breakout.alignfull,
.hunyuan3d-breakout.alignwide {
    width: 100% !important;
    max-width: 100% !important;
}

/* Neutralize common theme wrappers */
.entry-content .hunyuan3d-breakout,
.post-content .hunyuan3d-breakout,
.content-area .hunyuan3d-breakout,
.site-content .hunyuan3d-breakout,
main .hunyuan3d-breakout {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Allow internal Tailwind max containers to stretch */
.hunyuan3d-breakout .max-w-6xl,
.hunyuan3d-breakout .max-w-5xl,
.hunyuan3d-breakout .max-w-7xl {
    max-width: 100% !important;
}

/* Remove column layout constraints some themes add */
.hunyuan3d-breakout .wp-block-columns { max-width: 100% !important; }

/* Ensure pricing grid spans full width */
.hunyuan3d-breakout .grid { width: 100%; }

/* Override common WordPress theme containers */
.page .entry-content .hunyuan3d-signup-page-template,
.page .post-content .hunyuan3d-signup-page-template,
.page .content-area .hunyuan3d-signup-page-template {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    max-width: none !important;
}

/* Override theme width constraints */
.hunyuan3d-signup-page-template {
    clear: both !important;
    float: none !important;
}

/* ==========================================================================
   Additional Styles for Custom Elements (Tailwind provides most styling)
   ========================================================================== */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    /* Removed rotation animation to keep spinner static */
    background-color: #3498db;
    border: none;
    border-radius: 4px;
    width: auto;
    height: auto;
    padding: 2px 8px;
    font-size: 0.875rem;
    color: #fff;
}


/* Stripe Elements styling */
.StripeElement {
    box-sizing: border-box;
    height: 40px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background-color: white;
    box-shadow: 0 1px 3px 0 #e6ebf1;
    -webkit-transition: box-shadow 150ms ease;
    transition: box-shadow 150ms ease;
}

.StripeElement--focus {
    box-shadow: 0 1px 3px 0 #cfd7df;
}

.StripeElement--invalid {
    border-color: #fa755a;
}

.StripeElement--webkit-autofill {
    background-color: #fefde5 !important;
}

/* Larger Stripe card element for more input space */
.stripe-card-large {
    min-height: 56px; /* taller field */
    padding: 14px 16px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background-color: #ffffff;
    box-shadow: 0 6px 12px rgba(0,0,0,0.06);
}

/* ==========================================================================
   Dashboard Styles
   ========================================================================== */

.hunyuan3d-user-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.4em;
}

.plan-name {
    font-size: 1.8em;
    font-weight: bold;
    color: #4CAF50;
    margin: 10px 0;
}

.plan-status {
    color: #666;
    margin-bottom: 20px;
}

.credit-count {
    font-size: 2.2em;
    font-weight: bold;
    color: #2196F3;
    margin: 10px 0;
}

.storage-status {
    font-size: 1.2em;
    font-weight: 600;
    margin: 10px 0;
}

.storage-status.available {
    color: #4CAF50;
}

.storage-note {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.upgrade-btn, .purchase-btn, .storage-btn, .settings-btn {
    display: inline-block;
    padding: 12px 20px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
    text-align: center;
}

.upgrade-btn:hover, .purchase-btn:hover, .storage-btn:hover, .settings-btn:hover {
    background: #45a049;
    color: white;
}

/* ==========================================================================
   Credits Page Styles
   ========================================================================== */

.hunyuan3d-credits-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.credits-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
}

.current-balance {
    margin-top: 15px;
}

.balance-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.balance-amount {
    font-size: 2.5em;
    font-weight: bold;
    margin-left: 10px;
}

.current-plan-info {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 40px;
}

.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.credit-package {
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.credit-package:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-color: #4CAF50;
}

.credit-package.popular {
    border-color: #4CAF50;
    transform: scale(1.02);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
}

.package-credits {
    margin: 20px 0;
}

.base-credits {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.bonus-credits {
    color: #4CAF50;
    font-size: 0.9em;
    display: block;
    margin: 5px 0;
}

.total-credits {
    color: #666;
    font-size: 0.9em;
}

.package-price {
    margin: 20px 0;
}

.price {
    font-size: 2em;
    font-weight: bold;
    color: #2196F3;
}

.per-credit {
    color: #666;
    font-size: 0.8em;
    display: block;
    margin-top: 5px;
}

.purchase-package-btn {
    width: 100%;
    padding: 12px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.purchase-package-btn:hover {
    background: #45a049;
}

/* ==========================================================================
   Storage Page Styles
   ========================================================================== */

.hunyuan3d-storage-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.header-info {
    display: flex;
    gap: 20px;
}

.credits-info, .plan-info {
    padding: 8px 15px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.model-generator {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
    border: 1px solid #e1e5e9;
}

.generator-form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group textarea,
.form-group select,
.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus,
.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.generate-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.3s ease;
}

.generate-btn:hover {
    background: #45a049;
}

.cost-info {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

.models-library {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    border: 1px solid #e1e5e9;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.library-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.model-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #e1e5e9;
    transition: transform 0.3s ease;
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.model-preview-thumb {
    aspect-ratio: 1;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.placeholder-thumb {
    font-size: 2em;
    color: #6c757d;
    font-weight: bold;
}

.model-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.1em;
}

.model-date {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

.model-actions {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1e5e9;
}

.action-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.action-btn:hover {
    color: #4CAF50;
}

.delete-btn:hover {
    color: #f44336;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #333;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.payment-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.payment-history-table th,
.payment-history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.payment-history-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.status-success {
    color: #4CAF50;
    font-weight: 600;
}

.billing-management {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.cancel-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.cancel-btn:hover {
    background: #d32f2f;
}

.cancel-note {
    font-size: 0.9em;
    color: #666;
    margin-top: 10px;
}

/* ==========================================================================
   Upgrade Notice Styles
   ========================================================================== */

.hunyuan3d-upgrade-notice {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

.upgrade-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
}

.upgrade-benefits {
    margin: 30px 0;
    text-align: left;
}

.upgrade-benefits ul {
    list-style: none;
    padding: 0;
}

.upgrade-benefits li {
    padding: 8px 0;
    position: relative;
    padding-left: 25px;
}

.upgrade-benefits li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-weight: bold;
}

.upgrade-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.upgrade-btn {
    padding: 15px 25px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.upgrade-btn.primary {
    background: #4CAF50;
    color: white;
}

.upgrade-btn.primary:hover {
    background: #45a049;
    color: white;
}

.upgrade-btn.secondary {
    background: transparent;
    color: #4CAF50;
    border: 2px solid #4CAF50;
}

.upgrade-btn.secondary:hover {
    background: #4CAF50;
    color: white;
}

/* ==========================================================================
   Spinner Animation
   ========================================================================== */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .storage-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .header-info {
        justify-content: space-around;
    }
    
    .models-grid {
        grid-template-columns: 1fr;
    }
    
    .packages-grid {
        grid-template-columns: 1fr;
    }
    
    .library-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .library-stats {
        justify-content: space-around;
    }
    
    .upgrade-actions {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center {
    text-align: center;
}

.text-success {
    color: #4CAF50;
}

.text-error {
    color: #f44336;
}

.text-warning {
    color: #ff9800;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* ==========================================================================
   WordPress Admin Styles
   ========================================================================== */

.wrap .hunyuan3d-admin {
    max-width: 1200px;
}

.hunyuan3d-admin .form-table th {
    width: 200px;
}

.hunyuan3d-admin .form-table td {
    padding: 15px 10px;
}

.hunyuan3d-admin .description {
    font-style: italic;
    color: #666;
    margin-top: 5px;
}