/**
 * Modern Glassmorphism Frontend Styles for WooCommerce Engraving Extension
 */

/* ==========================================================================
   Variables and Base Styles
   ========================================================================== */

:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --glass-blur: blur(20px);
    --primary-color: #007cba;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --border-radius: 16px;
}

/* ==========================================================================
   Engraving Button - Modern Style
   ========================================================================== */

button.wc-toggle-debug{
    display: none !important;
}

.wc-engraving-button-container {
    margin: 24px 0;
    padding: 0;
    background: transparent;
    border: none;
}

.wc-engraving-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px 0 rgba(31, 38, 135, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.wc-engraving-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px 0 rgba(31, 38, 135, 0.3);
    color: white;
    text-decoration: none;
}

.wc-engraving-button:before {
    content: "✨";
    font-size: 1.2em;
}

/* ==========================================================================
   Modal Overlay and Container
   ========================================================================== */

.wc-engraving-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.wc-engraving-modal-content {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 2% auto;
    padding: 0;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    border-radius: 24px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    overflow: hidden;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Modal Header
   ========================================================================== */

.wc-engraving-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.wc-engraving-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.wc-engraving-header h2:before {
    content: "✨";
    font-size: 1.2em;
}

.wc-engraving-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-engraving-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

/* ==========================================================================
   Modal Content Layout
   ========================================================================== */

.wc-engraving-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100% - 80px);
    overflow: hidden;
}

/* Left Side - Preview */
.wc-engraving-preview-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.wc-engraving-preview-section::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    transform: rotate(45deg);
    opacity: 0.5;
}

/* Canvas Tabs */
.wc-engraving-canvas-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    z-index: 1;
}

.wc-frontend-canvas-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wc-frontend-canvas-tab:hover {
    background: rgba(255, 255, 255, 0.5);
}

.wc-frontend-tab-active {
    background: white !important;
    color: var(--primary-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Preview Container */
.wc-engraving-preview-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    max-width: 500px;
    width: 100%;
    z-index: 1;
}

.wc-engraving-image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    background: #f7fafc;
    border-radius: 12px;
    overflow: hidden;
}

.wc-engraving-preview-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Preview Warning Text */
.wc-engraving-preview-warning {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    font-style: italic;
    opacity: 0.8;
}

/* Right Side - Controls */
.wc-engraving-controls-section {
    background: rgba(255, 255, 255, 0.5);
    padding: 40px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Zone Cards */
.engraving-zone {
    margin-bottom: 24px;
    padding: 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.engraving-zone:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.engraving-zone h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.engraving-zone h4:before {
    content: "✏️";
    font-size: 1.1em;
}

/* Form Controls */
.engraving-zone label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.engraving-zone input[type="text"],
.engraving-zone select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
    color: var(--text-primary);
}

.engraving-zone input[type="text"]:focus,
.engraving-zone select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Font Size Controls */
.font-size-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.font-size-minus,
.font-size-plus {
    width: 36px;
    height: 36px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.font-size-minus:hover,
.font-size-plus:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.font-size-display {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

/* Cost Display */
.engraving-cost {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f0f9ff;
    border-radius: 8px;
    font-size: 14px;
    color: #0369a1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cost-amount {
    font-weight: 600;
}

/* Total Cost */
#total-engraving-cost {
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    text-align: center;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Clear Button */
#clear-all-engraving {
    width: 100%;
    padding: 14px 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#clear-all-engraving:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Debug Button */
.wc-toggle-debug {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wc-toggle-debug:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Zone Boundaries (Debug) */
.wc-engraving-zone {
    transition: all 0.3s ease;
}

.wc-show-bounds .wc-engraving-zone {
    border: 2px dashed rgba(0, 124, 186, 0.5) !important;
    background: rgba(0, 124, 186, 0.05) !important;
}

/* Scrollbar Styling */
.wc-engraving-controls-section::-webkit-scrollbar {
    width: 8px;
}

.wc-engraving-controls-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.wc-engraving-controls-section::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.wc-engraving-controls-section::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wc-engraving-body {
        grid-template-columns: 1fr;
    }
    
    .wc-engraving-preview-section {
        min-height: 400px;
        padding: 24px;
    }
    
    .wc-engraving-controls-section {
        padding: 24px;
    }
}

@media (max-width: 640px) {
    .wc-engraving-modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .wc-engraving-header {
        padding: 16px;
    }
    
    .wc-engraving-preview-section,
    .wc-engraving-controls-section {
        padding: 16px;
    }
    
    .engraving-zone {
        padding: 16px;
    }
}

/* ==========================================================================
   SweetAlert Engraving Popup Styles
   ========================================================================== */

.wc-engraving-swal-popup {
    font-family: inherit;
}

.wc-engraving-swal-popup .swal2-actions {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 0 20px;
}

.wc-engraving-swal-popup .swal2-confirm,
.wc-engraving-swal-popup .swal2-cancel {
    width: 100%;
    margin: 0 !important;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.wc-engraving-swal-popup .swal2-confirm {
    background: linear-gradient(135deg, #c3914b 0%, #a67c3d 100%) !important;
    box-shadow: 0 4px 12px rgba(195, 145, 75, 0.3);
}

.wc-engraving-swal-popup .swal2-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(195, 145, 75, 0.4);
}

.wc-engraving-swal-checkout-btn {
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 2px solid #dee2e6 !important;
}

.wc-engraving-swal-checkout-btn:hover {
    background: #e9ecef !important;
    border-color: #c3914b !important;
    color: #c3914b !important;
}

/* ==========================================================================
   Checkout Engraving Message Field Styles
   ========================================================================== */

.wc-engraving-checkout-message {
    background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
    border: 2px solid #c3914b;
    border-radius: 12px;
    padding: 20px !important;
    margin-bottom: 30px !important;
}

.wc-engraving-checkout-message label {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #8b6914 !important;
    margin-bottom: 12px !important;
    display: block;
}

.wc-engraving-checkout-message textarea {
    border: 2px solid #e0d4b8 !important;
    border-radius: 8px !important;
    padding: 16px !important;
    font-size: 15px !important;
    min-height: 120px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wc-engraving-checkout-message textarea:focus {
    border-color: #c3914b !important;
    box-shadow: 0 0 0 3px rgba(195, 145, 75, 0.15) !important;
    outline: none !important;
}

.wc-engraving-checkout-message .optional {
    display: none;
}

/* Hide the original order comments when using engraving checkout message */
.woocommerce-checkout .form-row.hidden,
.woocommerce-checkout #order_comments_field.hidden {
    display: none !important;
}

/* Engraving message field in billing section */
#engraving_message_field {
    background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
    border: 2px solid #c3914b;
    border-radius: 12px;
    padding: 20px !important;
    margin-bottom: 30px !important;
    order: -1;
}

#engraving_message_field label {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #8b6914 !important;
    margin-bottom: 12px !important;
    display: block;
}

#engraving_message_field textarea,
#engraving_message {
    border: 2px solid #e0d4b8 !important;
    border-radius: 8px !important;
    padding: 16px !important;
    font-size: 15px !important;
    min-height: 120px !important;
    width: 100% !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#engraving_message_field textarea:focus,
#engraving_message:focus {
    border-color: #c3914b !important;
    box-shadow: 0 0 0 3px rgba(195, 145, 75, 0.15) !important;
    outline: none !important;
}