/**
 * Size Chart Styles
 * Designed for Seashell Beauty & Nail theme
 */

/* Size Chart Button */
.size-chart-wrapper {
    margin: 10px 0;
    display: inline-block;
}

/* When positioned next to quantity container or other elements */
.size-chart-positioned {
    margin: 0 0 0 15px !important;
    display: inline-block !important;
    vertical-align: top !important;
}

/* Alternative positioning if elements are stacked */
.size-chart-positioned.stacked {
    display: block !important;
    margin: 10px 0 !important;
}

/* Wrapper for quantity and size chart to be inline */
.quantity-sizechart-wrapper {
    display: flex !important;
    align-items: flex-start !important;
    gap: 15px !important;
    flex-wrap: wrap !important;
}

/* Ensure ux-quantity maintains its original styling within wrapper */
.quantity-sizechart-wrapper .ux-quantity {
    flex: 0 0 auto;
}

/* Size chart button within the wrapper */
.quantity-sizechart-wrapper .size-chart-positioned {
    flex: 0 0 auto;
    margin: 0 !important;
    align-self: flex-start;
}

/* Size chart button within cart form */
.size-chart-in-cart,
.size-chart-in-form,
.size-chart-in-cart-final {
    display: inline-block !important;
    margin-left: 15px !important;
    vertical-align: top !important;
}

/* Ensure size chart button aligns properly with quantity in cart form */
form.cart .size-chart-in-cart,
form.cart .size-chart-in-form,
form.cart .size-chart-in-cart-final,
.cart form .size-chart-in-cart,
.cart form .size-chart-in-form,
.cart form .size-chart-in-cart-final {
    display: inline-block !important;
    margin-left: 15px !important;
    vertical-align: middle !important;
}

/* Fallback position styling */
.size-chart-fallback {
    text-align: center;
    margin: 15px 0;
}

.size-chart-fallback .size-chart-trigger {
    padding: 8px 16px;
    font-size: 14px;
}

.size-chart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 25px;
    padding: 6px 24px;
    background: transparent;
    border: 1px solid var(--color-primary, #d3420d);
    color: var(--color-primary, #d3420d);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    outline: none;
    white-space: nowrap;
    line-height: 1;
}

form.cart {
    position: relative;
}

form.cart .size-chart-in-form {
    position: absolute;
    right: 0;
}

/* Smaller button when positioned next to label */
.size-chart-positioned .size-chart-trigger {
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
}

.size-chart-positioned .size-chart-trigger i {
    font-size: 12px;
}

.size-chart-trigger:hover {
    background: var(--color-primary, #d3420d);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(211, 66, 13, 0.2);
}

.size-chart-trigger:focus {
    box-shadow: 0 0 0 3px rgba(211, 66, 13, 0.1);
}

.size-chart-trigger i {
    font-size: 16px;
}

/* Overlay */
.size-chart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.size-chart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Aside Panel */
.size-chart-aside {
    position: absolute;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.size-chart-overlay.active .size-chart-aside {
    right: 0;
}

/* Header */
.size-chart-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    position: sticky;
    top: 0;
    z-index: 10;
}

.size-chart-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-heading, #042436);
}

.size-chart-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    border-radius: 50px;
    color: #333;
    background-color: var(--color-border);
    transition: all 0.2s ease;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    line-height: 26px;
    text-align: center;
    margin: 0;
    max-width: unset;
}

.size-chart-close:hover {
    background: #e0e0e0;
    color: var(--color-primary, #d3420d);
}

/* Content */
.size-chart-content {
    flex: 1;
    padding: 24px;
    line-height: 1.6;
}

/* Size Guide Styles */
.size-guide h4 {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-heading, #042436);
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-primary, #d3420d);
}

.size-step {
    margin-bottom: 32px;
}

.size-step h5 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-heading, #042436);
    margin: 0 0 16px 0;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.measurement-methods {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
}

.method {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--color-primary, #d3420d);
}

.method h6 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary, #d3420d);
    margin: 0 0 8px 0;
    text-transform: uppercase;
}

.method p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Size Table */
.size-table {
    overflow-x: auto;
    margin-bottom: 20px;
}

.size-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.size-table thead th {
    background: var(--color-primary, #d3420d);
    color: white;
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
}

.size-table tbody td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.size-table tbody tr:hover {
    background: #f8f9fa;
}

.size-table tbody td:first-child {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--color-primary, #d3420d);
}

.size-table small {
    display: block;
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 8px;
}

/* Size Notes */
.size-notes ul {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff8f0;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ffeaa7;
}

.size-notes li {
    margin-bottom: 8px;
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}

.size-notes li:last-child {
    margin-bottom: 0;
}

.size-notes strong {
    color: var(--color-primary, #d3420d);
}

/* Nail Shapes */
.nail-shapes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.shape-item {
    text-align: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: transform 0.2s ease;
}

.shape-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shape-item h6 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-heading, #042436);
}

.shape-item small {
    color: #666;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .size-chart-aside {
        width: 100%;
        right: -100%;
    }

    .size-chart-header {
        padding: 16px 20px;
    }

    .size-chart-header h3 {
        font-size: 18px;
    }

    .size-chart-content {
        padding: 20px;
    }

    .size-guide h4 {
        font-size: 20px;
    }

    .size-step h5 {
        font-size: 16px;
    }

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

    .nail-shapes {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }

    .size-table thead th,
    .size-table tbody td {
        padding: 8px 4px;
        font-size: 11px;
    }

    .size-notes {
        padding: 16px;
    }

    .size-notes li {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .size-chart-trigger {
        font-size: 12px;
        padding: 6px 12px;
    }

    .size-chart-trigger i {
        font-size: 14px;
    }

    /* Ensure button doesn't break layout on small screens */
    .size-chart-positioned .size-chart-trigger {
        padding: 3px 6px;
        font-size: 10px;
    }

    .size-chart-positioned .size-chart-trigger span {
        display: none;
    }

    /* Stack quantity and size chart on mobile if needed */
    .quantity-sizechart-wrapper {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .size-chart-header {
        padding: 12px 16px;
    }

    .size-chart-content {
        padding: 16px;
    }

    .nail-shapes {
        grid-template-columns: 1fr;
    }

    .size-table thead th,
    .size-table tbody td {
        padding: 6px 2px;
        font-size: 10px;
    }
}

/* Animation for smooth scrolling */
.size-chart-content {
    scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
.size-chart-aside::-webkit-scrollbar {
    width: 6px;
}

.size-chart-aside::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.size-chart-aside::-webkit-scrollbar-thumb {
    background: var(--color-primary, #d3420d);
    border-radius: 3px;
}

.size-chart-aside::-webkit-scrollbar-thumb:hover {
    background: #b8380b;
}

/* Focus styles for accessibility */
.size-chart-trigger:focus-visible,
.size-chart-close:focus-visible {
    outline: 2px solid var(--color-primary, #d3420d);
    outline-offset: 2px;
}

/* Print styles */
@media print {

    .size-chart-overlay,
    .size-chart-trigger {
        display: none !important;
    }
}