/* Measurements Shortcode Styles */

/* Brand Colors */
:root {
    --brand-dark: #061c1c;
    --brand-teal: #112626;
    --brand-cream: #ffead5;
    --brand-light: #f8f8f8;
    --brand-white: #ffffff;
    --brand-sage: #8fa29a;
    --brand-error: #dc3545;
}

.wcdt-measurements-shortcode {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
    border-radius: 8px;
    min-height: 100vh;
    position: relative;
    box-sizing: border-box;
}

/* Content is visible by default - no loading state */
.wcdt-measurements-shortcode > * {
    opacity: 1;
    visibility: visible;
}

/* Hide sticky elements initially to prevent flashing during positioning */
.wcdt-sticky-toggle,
.wcdt-sticky-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Show sticky elements after JavaScript initializes them */
.wcdt-sticky-initialized .wcdt-sticky-toggle,
.wcdt-sticky-initialized .wcdt-sticky-panel {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Loading overlay - full screen */
.wcdt-measurements-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcdt-measurements-loader {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.wcdt-measurements-loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--brand-dark);
    border-radius: 50%;
    animation: wcdt-spin 1s linear infinite;
    margin: 0 auto 30px;
}

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

.wcdt-measurements-loader-text {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.wcdt-measurements-loader-subtext {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.6;
}

.wcdt-measurements-shortcode h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 35px;
    color: #2c3e50;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

/* Login Notice */
.wcdt-measurements-login-notice {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
}

.wcdt-measurements-login-notice p {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

/* View Mode */
.wcdt-measurements-view .wcdt-measurement-profile {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.wcdt-measurement-profile h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcdt-default-badge {
    background: var(--brand-sage);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: normal;
}

.wcdt-measurement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.wcdt-measurement-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 3px solid var(--brand-sage);
}

.wcdt-label {
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.wcdt-value {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.wcdt-measurement-date {
    font-size: 12px;
    color: #999;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* Edit Mode */
.wcdt-measurements-edit {
    background: white;
    border-radius: 8px;
    padding: 0;
}

/* Product Selector Checkboxes */
.wcdt-product-selector {
    margin-bottom: 40px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease;
    /* Prevent width changes */
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.wcdt-product-selector:hover {
    box-shadow: 0 6px 25px rgba(0,0,0,0.12);
}

.wcdt-product-selector h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.wcdt-product-selector-subtitle {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 25px;
    line-height: 1.5;
}

.wcdt-product-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.wcdt-product-checkbox-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s, transform 0.3s;
    font-size: 16px;
    font-weight: 500;
    color: #34495e;
    overflow: hidden;
    will-change: border-color, background, transform;
}

.wcdt-product-checkbox-label:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    transition: width 0.3s ease;
    z-index: 0;
}

.wcdt-product-checkbox-label:hover {
    border-color: var(--brand-sage);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.wcdt-product-checkbox-label:hover:before {
    width: 100%;
}

.wcdt-product-checkbox {
    position: relative;
    width: 22px;
    height: 22px;
    cursor: pointer;
    z-index: 1;
}

.wcdt-product-checkbox-label span {
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

.wcdt-product-checkbox:checked + span {
    color: var(--brand-sage);
    /* Remove font-weight change to prevent layout shift */
}

.wcdt-product-checkbox-label:has(.wcdt-product-checkbox:checked) {
    border-color: var(--brand-sage);
    background: linear-gradient(135deg, #f0fdf4 0%, #e8f5e9 100%);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.25);
    transform: translateY(-2px);
}

.wcdt-product-checkbox-label:has(.wcdt-product-checkbox:checked):before {
    width: 100%;
}

/* Hide fields and sections initially when using checkboxes */
.wcdt-unified-form .wcdt-measurement-fields-grid:not(.wcdt-sticky-sections) {
    display: none;
}

/* CRITICAL: Sticky sections must ALWAYS be displayed */
.wcdt-unified-form .wcdt-measurement-fields-grid.wcdt-sticky-sections {
    display: grid !important;
}

.wcdt-unified-form .wcdt-form-actions {
    display: none;
}

/* Show suggested fields with a subtle indicator */
.wcdt-field input.suggested {
    border-color: var(--brand-teal);
    background: var(--brand-cream);
}

/* Tabs */
.wcdt-measurement-tabs {
    margin-bottom: 30px;
}

.wcdt-tab-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    border-bottom: 2px solid #e0e0e0;
}

.wcdt-tab-nav li {
    margin: 0;
}

.wcdt-tab-nav a {
    display: block;
    padding: 12px 24px;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.wcdt-tab-nav a:hover {
    color: #333;
    background: #f9f9f9;
}

.wcdt-tab-nav a.active {
    color: var(--brand-sage);
    border-bottom-color: var(--brand-sage);
    background: #f9f9f9;
}

.wcdt-tab-content {
    display: none;
}

.wcdt-tab-content.active {
    display: block;
}

/* Form Fields */
.wcdt-measurement-fields-grid {
    margin-bottom: 30px;
}

.wcdt-measurement-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.wcdt-measurement-section h4 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    text-transform: none;
}

.wcdt-fields-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.wcdt-field {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wcdt-field label {
    font-size: 14px;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wcdt-field input,
.wcdt-field select,
.wcdt-field textarea {
    padding: 12px 14px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    width: 100%;
    box-sizing: border-box;
}

.wcdt-field input:hover,
.wcdt-field select:hover,
.wcdt-field textarea:hover {
    border-color: #95a5a6;
}

.wcdt-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2334495e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.wcdt-field textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.wcdt-field input:focus,
.wcdt-field select:focus,
.wcdt-field textarea:focus {
    outline: none;
    border-color: var(--brand-sage);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
    transform: translateY(-1px);
}

.wcdt-field input::placeholder,
.wcdt-field textarea::placeholder {
    color: #999;
}

/* Full width field for comments */
.wcdt-field-full {
    grid-column: 1 / -1;
}

/* Unit label styling */
.wcdt-unit {
    font-size: 12px;
    color: #999;
    font-weight: normal;
    margin-left: 4px;
}

/* Form Actions */
.wcdt-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 30px;
}

.wcdt-default-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #34495e;
    cursor: pointer;
    transition: color 0.3s ease;
}

.wcdt-default-checkbox:hover {
    color: var(--brand-sage);
}

.wcdt-default-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--brand-sage);
}

.wcdt-buttons {
    display: flex;
    gap: 15px;
}

.wcdt-save-measurements,
.wcdt-delete-measurements {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.wcdt-save-measurements {
    background: var(--brand-sage);
    color: white;
}

.wcdt-save-measurements:hover:not(:disabled) {
    background: var(--brand-sage);
}

.wcdt-save-measurements:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wcdt-delete-measurements {
    background: #e74c3c;
    color: white;
}

.wcdt-delete-measurements:hover {
    background: #c0392b;
}

/* Measurement Guide */
.wcdt-measurement-guide {
    margin-top: 40px;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid var(--brand-sage);
}

.wcdt-measurement-guide h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.wcdt-measurement-guide p {
    color: #666;
    margin-bottom: 20px;
}

.wcdt-guide-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.wcdt-guide-buttons .button {
    padding: 10px 20px;
    background: white;
    color: var(--brand-sage);
    border: 2px solid var(--brand-sage);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.wcdt-guide-buttons .button:hover {
    background: var(--brand-sage);
    color: white;
}

/* My Account Integration */
.wcdt-my-account-measurements {
    margin-top: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.wcdt-my-account-measurements h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.wcdt-my-account-measurements ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.wcdt-my-account-measurements li {
    padding: 8px 0;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

.wcdt-my-account-measurements li:last-child {
    border-bottom: none;
}

/* Success/Error Messages */
.wcdt-message {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
    font-size: 14px;
    border-left: 4px solid;
}

.wcdt-message.success {
    background: #d4edda;
    color: #155724;
    border-color: var(--brand-sage);
}

.wcdt-message.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #e74c3c;
}

.wcdt-message.show {
    display: block;
}

/* Sticky Panel - Toggle & Slide-In Overlay */

/* Main layout - always full width */
.wcdt-measurement-layout {
    display: block;
}

.wcdt-main-sections {
    width: 100%;
}

/* Toggle Button - Prominent Floating Button */
.wcdt-sticky-toggle {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #8fa29a 0%, #7a8d84 100%);
    color: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(143, 162, 154, 0.6);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wcdt-sticky-toggle:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 30px rgba(143, 162, 154, 0.8);
}

/* Hide button when at placeholder (section in view) */
.wcdt-sticky-toggle.wcdt-at-placeholder {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.wcdt-sticky-toggle-icon {
    font-size: 22px;
    line-height: 1;
}

/* Section Placeholder - Looks Like Normal Section */
.wcdt-sticky-placeholder {
    /* Collapsed state - minimal height, no visible content */
    min-height: 20px;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin-bottom: 30px;
}

/* Placeholder expansion for fields */
.wcdt-placeholder-fields-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wcdt-sticky-placeholder.wcdt-expanded .wcdt-placeholder-fields-container {
    max-height: 3000px;
    opacity: 1;
}

.wcdt-sticky-placeholder.wcdt-expanded {
    padding: 0 !important;
}

/* Reset padding on fields grid inside placeholder */
.wcdt-sticky-placeholder .wcdt-measurement-fields-grid {
    padding: 0 !important;
    margin-bottom: 0;
}

.wcdt-sticky-placeholder .wcdt-sticky-sections {
    padding: 0 !important;
}

.wcdt-sticky-placeholder .wcdt-measurement-section {
    margin-bottom: 0;
}

/* Sticky Panel - Compact Slide-In From Right */
.wcdt-sticky-panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    width: 420px;
    max-width: 90vw;
    max-height: 60vh;
    background: white;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 1020;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-radius: 12px 0 0 12px;
}

body.wcdt-sticky-panel-open .wcdt-sticky-panel {
    transform: translateY(-50%) translateX(0);
}

/* Panel Header */
.wcdt-sticky-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #8fa29a 0%, #7a8d84 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.wcdt-sticky-panel-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.wcdt-sticky-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.wcdt-sticky-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Panel Content Container */
.wcdt-sticky-fields-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Panel Content */
.wcdt-sticky-sections {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

/* Sticky section visual distinction */
.wcdt-sticky-sections .wcdt-measurement-section {
    background: linear-gradient(135deg, #f8f8f8 0%, #fff 100%);
    border: 2px solid #8fa29a;
    box-shadow: 0 2px 8px rgba(143, 162, 154, 0.1);
}

.wcdt-sticky-sections .wcdt-measurement-section h4 {
    color: #5d7067;
    border-bottom-color: #8fa29a;
}

.wcdt-sticky-sections .wcdt-measurement-section h4:before {
    content: '📌 ';
    margin-right: 6px;
}

/* Custom scrollbar for sticky sections */
.wcdt-sticky-sections::-webkit-scrollbar {
    width: 8px;
}

.wcdt-sticky-sections::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wcdt-sticky-sections::-webkit-scrollbar-thumb {
    background: #8fa29a;
    border-radius: 4px;
}

.wcdt-sticky-sections::-webkit-scrollbar-thumb:hover {
    background: #7a8d84;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wcdt-measurements-shortcode {
        padding: 15px;
    }

    .wcdt-measurements-shortcode h2 {
        font-size: 24px;
    }

    .wcdt-measurement-grid {
        grid-template-columns: 1fr;
    }

    .wcdt-fields-row {
        grid-template-columns: 1fr;
    }

    .wcdt-tab-nav {
        flex-direction: column;
        border-bottom: none;
    }

    .wcdt-tab-nav a {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .wcdt-tab-nav a.active {
        border-left-color: var(--brand-sage);
    }

    .wcdt-product-checkboxes {
        flex-direction: column;
    }

    .wcdt-product-checkbox-label {
        width: 100%;
        justify-content: flex-start;
    }

    .wcdt-form-actions {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }

    .wcdt-buttons {
        flex-direction: column;
    }

    .wcdt-guide-buttons {
        flex-direction: column;
    }

    .wcdt-guide-buttons .button {
        width: 100%;
        text-align: center;
    }

    /* Mobile sticky panel - compact slide-in */
    .wcdt-sticky-panel {
        width: 90%;
        max-width: 90%;
        max-height: 80vh;
        border-radius: 12px 0 0 12px;
    }

    .wcdt-sticky-toggle {
        right: 10px;
        padding: 12px 16px;
        font-size: 13px;
        gap: 6px;
    }

    .wcdt-sticky-toggle-text {
        display: inline;
    }

    .wcdt-sticky-toggle-icon {
        font-size: 18px;
    }

    .wcdt-sticky-panel-header {
        padding: 15px 20px;
    }

    .wcdt-sticky-sections {
        padding: 20px;
    }
}

/* Info Icon and Tooltip */
.wcdt-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background: #8fa29a;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    font-style: normal;
    cursor: help;
    position: relative;
    transition: all 0.2s ease;
}

.wcdt-info-icon:hover {
    background: #7a8d84;
    transform: scale(1.1);
}

.wcdt-info-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #061c1c;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.4;
    white-space: normal;
    max-width: 250px;
    width: max-content;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcdt-info-icon::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 6px solid transparent;
    border-top-color: #061c1c;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
}

.wcdt-info-icon:hover::before,
.wcdt-info-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Helper Text */
.wcdt-helper-text {
    margin-top: 6px;
    font-size: 12px;
    color: #7a8d84;
    line-height: 1.4;
    font-style: italic;
}

.wcdt-field-full .wcdt-helper-text {
    margin-top: 8px;
}

/* Print Styles */
@media print {
    .wcdt-measurements-edit .wcdt-buttons,
    .wcdt-measurement-guide,
    .wcdt-tab-nav {
        display: none;
    }

    .wcdt-measurement-profile {
        page-break-inside: avoid;
    }

    .wcdt-measurement-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Measurement Change History Modal
   ======================================== */

.wcdt-history-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wcdt-history-modal {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.wcdt-history-header {
    padding: 20px 30px;
    border-bottom: 2px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #8fa29a 0%, #7a8d84 100%);
    border-radius: 12px 12px 0 0;
}

.wcdt-history-header h2 {
    margin: 0;
    color: white;
    font-size: 22px;
    font-weight: 600;
}

.wcdt-history-close {
    background: none;
    border: none;
    font-size: 32px;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.wcdt-history-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wcdt-history-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.wcdt-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.wcdt-no-history {
    text-align: center;
    padding: 60px 40px;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

.wcdt-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px 20px;
    border-radius: 6px;
    text-align: center;
}

/* Timeline Styles */
.wcdt-history-timeline {
    position: relative;
}

.wcdt-history-date-group {
    margin-bottom: 30px;
}

.wcdt-history-date-separator {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
}

.wcdt-history-entry {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
    border-left: 3px solid #8fa29a;
    transition: background 0.2s;
}

.wcdt-history-entry:hover {
    background: #f5f5f5;
}

.wcdt-history-time {
    color: #999;
    font-size: 12px;
    min-width: 80px;
    padding-top: 2px;
}

.wcdt-history-details {
    flex: 1;
}

.wcdt-history-field {
    font-size: 15px;
    margin-bottom: 6px;
    color: #333;
}

.wcdt-history-change {
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wcdt-old-value {
    background: #ffe6e6;
    color: #c33;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: monospace;
}

.wcdt-new-value {
    background: #e6f4ea;
    color: #2d7a3f;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: monospace;
}

.wcdt-arrow {
    color: #999;
    font-weight: bold;
}

.wcdt-history-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wcdt-changed-by {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.wcdt-changed-by small {
    font-size: 9px;
    opacity: 0.8;
    font-weight: 400;
    text-transform: uppercase;
}

.wcdt-changed-by.wcdt-admin {
    background: #667eea;
    color: white;
}

.wcdt-changed-by.wcdt-customer {
    background: #48bb78;
    color: white;
}

.wcdt-ip {
    color: #999;
    font-size: 11px;
    font-family: monospace;
}

/* History Search */
.wcdt-history-search {
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.wcdt-history-search input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.wcdt-history-search input[type="text"]:focus {
    outline: none;
    border-color: var(--brand-sage);
    box-shadow: 0 0 0 3px rgba(143, 162, 154, 0.1);
}

.wcdt-history-search .button {
    padding: 10px 20px;
    background: var(--brand-dark);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.wcdt-history-search .button:hover {
    background: var(--brand-teal);
}

/* Session Grouping */
.wcdt-history-session {
    margin-bottom: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.wcdt-session-header {
    background: #f9f9f9;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.wcdt-session-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.wcdt-change-count {
    color: #666;
    font-size: 12px;
    background: white;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #ddd;
}

.wcdt-session-changes {
    padding: 0;
}

.wcdt-session-changes .wcdt-history-entry {
    border-bottom: 1px solid #f0f0f0;
    margin: 0;
    border-radius: 0;
}

.wcdt-session-changes .wcdt-history-entry:last-child {
    border-bottom: none;
}

.wcdt-session-changes .wcdt-history-entry:hover {
    background: #f9f9f9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wcdt-history-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .wcdt-history-header {
        padding: 15px 20px;
        border-radius: 0;
    }

    .wcdt-history-header h2 {
        font-size: 18px;
    }

    .wcdt-history-content {
        padding: 20px;
    }

    .wcdt-history-entry {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .wcdt-history-time {
        min-width: auto;
    }

    .wcdt-history-change {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}