/* Cross Stitch Patterns Frontend Styles */
.cross-stitch-pattern {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Admin Styles */
.settings-container {
    max-width: 1200px;
    margin: 20px 0;
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h2 {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.settings-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.settings-card-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Patterns Grid */
.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pattern-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-card.selected {
    border-color: #4CAF50;
    background: #f0f9f0;
}

.pattern-card.orphaned {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.pattern-card.orphaned.selected {
    border-color: #ff4444;
    background: #ffe5e5;
}

.pattern-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.pattern-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.pattern-card .product-status {
    margin: 5px 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.pattern-card input[type="checkbox"] {
    display: none;
}

.pattern-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    align-items: center;
}

.pattern-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.pattern-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.patterns-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    grid-column: 1 / -1;
}

/* Ripple effect */
.pattern-card {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background-color: rgba(76,175,80,0.2);
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Product Ownership Styles */
.csp-owned-text {
    background: #f0f9f0;
    color: #2e7d32;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 500;
}

.single_add_to_cart_button:disabled {
    background-color: #f0f9f0 !important;
    color: #2e7d32 !important;
    cursor: not-allowed;
}

/* Pattern Information Display */
.csp-buttons-container {
    
}
.single-product-top form.cart{
    width: 100%;
    display: flex;
    gap: 12px;
    width: 100%;
    margin: 0px;
    padding: 10px 0px;
    border: 1px solid #f2f2f2;
    border-radius: 8px;
}

.csp-buttons-container .single_add_to_cart_button,
.csp-buttons-container .amazon-button {
    margin: 0 !important;
}

.info-fields-container {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.info-field {
    flex: 1;
    text-align: center;
    position: relative;
}

.info-field:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 40%;
    width: 1px;
    background-color: #ddd;
}

.field-value {
    font-size: 20px;
    margin-bottom: 5px;
}

.field-label {
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

/* Pattern Shortcode Styles */
.pattern-description {
    line-height: 1.6;
    color: #333;
    margin: 20px 0;
}

.color-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px; 
    max-height: 200px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.3s ease-out;
    font-size: 9pt !important;
}

.color-list.expanded {
    max-height: none;
    /*margin-bottom: 32px;*/
    padding-bottom: 32px;
}

.color-list-expand {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.color-list.expanded .color-list-expand {
    background: none;
    position: static;
    height: auto;
    padding-top: 10px;
}

.color-item {
    padding: 10px;
    border: 1px solid #f9f9f9;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.color-item:hover {
    resize: none;
    box-shadow: 0px 2px 4px hsl(0 0% 0% / 25%);
    animation: border-angle-rotate 12s infinite linear;
    border: 1px solid transparent;
    --border-angle: 0deg;
    background: linear-gradient(white, white) padding-box,
      conic-gradient(
          from var(--border-angle),
          oklch(100% 100% 0deg),
          oklch(100% 100% 45deg),
          oklch(100% 100% 90deg),
          oklch(100% 100% 135deg),
          oklch(100% 100% 180deg),
          oklch(100% 100% 225deg),
          oklch(100% 100% 270deg),
          oklch(100% 100% 315deg),
          oklch(100% 100% 360deg)
        )
        border-box;
}
@keyframes border-angle-rotate {
  from { --border-angle: 0deg; }
  to { --border-angle: 360deg; }
}
@property --border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.color-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.color-preview {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    position: relative;
    margin-left: 14px;
}

.color-symbol {
    font-size: 17px;
    font-weight: bold;
    width: 24px;
    min-width: 24px;
    text-align: center;
    color: black;
}

.color-dmc {
    color: #666;
    width: 76px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #f2f2f2;
    border-radius: 4px;
    padding: 3px 0px;
}

.color-name {
    color: #333;
    flex: 1;
}

.color-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin-right: 14px;
}

@media (max-width: 1200px) {
    
    .color-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px; 
    }
    .color-details {
        display: none;
    }
}

.stitch-count {
    font-size: 0.9em;
    color: #666;
}

@media (max-width: 768px) {
    .color-details {
        display: none;
    }

    .color-item {
        padding: 8px;
    }

    .color-preview {
        margin-left: 8px;
    }

    .color-main {
        gap: 8px;
    }

    .color-dmc {
        min-width: 60px;
        font-size: 13px;
    }

    .color-name {
        font-size: 13px;
    }
    .color-list {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 6px; 
    }
}

.stitch-count {
    font-size: 0.9em;
    color: #666;
}

.color-skeins {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    color: #666;
    font-size: 0.9em;
}

.skein-count {
    white-space: nowrap;
}

.print-colors-button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-bottom: 3px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    transition: all 0.2s ease;
}

.print-colors-button:hover {
    background: #f2f2f2;
    border: 1px solid #ddd;
    border-bottom: 3px solid #ddd;
}

.print-colors-button svg {
    width: 18px;
    height: 18px;
}

.pattern-stats .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 500px) { /* Adjust the breakpoint as needed */
    .pattern-stats .stats-grid > :last-child:nth-last-child(1) {
        grid-column: 1 / -1;
    }
}

.pattern-stats .stat-item {
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.pattern-stats .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.pattern-stats .stat-label {
    font-size: 14px;
    color: #666;
}

/* Size Table Styles */
.size-table-container {
    max-height: 100px;
    overflow: hidden;
    transition: all 0.3s ease-out;
    position: relative;
    background: #f9f9f9;
    border-radius: 6px;
}

.size-table-container.expanded {
    max-height: none;
}

 .size-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

.size-table th {
    background: #f5f5f5;
    font-weight: 500;
    color: #666;
    font-size: 13px !important;
    text-transform: uppercase !important;
    padding: 12px;
    text-align: center !important;
    border-bottom: 1px solid #eee;
}
.size-table th:first-child {
    text-align: left !important;
    padding-left: 20px;
}

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

.size-table td:first-child {
    font-weight: bold;
    text-align: left;
    padding-left: 20px;
}

.size-table td:not(:first-child) {
    text-align: center;
}

.size-table tr:last-child td {
    border-bottom: none;
}

.size-table-expand {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px 0;
    cursor: pointer;
    background: linear-gradient(to bottom, rgba(249,249,249,0.8), rgba(249,249,249,1));
    position: absolute;
    bottom: 0;
    left: 0;
    transition: all 0.3s ease;
}

.size-table-container.expanded .size-table-expand {
    position: relative;
    background: none;
}

.expand-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.size-table-container.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Pattern Keeper Bar */
.pattern-keeper-tested {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    padding: 20px 12px;
    padding-left: 0px;
    font-size: 16px;
    border-radius: 5px;
    transition: background 0.3s ease;
    text-align: center;
    color: black;
    font-size: 9pt;
    margin-bottom: 12px;
    background: #f2f2f2;
}

.pattern-keeper-tested img {
    height: 52px;
    margin-right: 16px;
}

/* Product Buttons */
.single_add_to_cart_button,
.amazon-button,
.amazon-button-details {    
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    height: 50px !important;
    border-radius: 5px !important;
    transition: background 0.3s ease;
    text-align: center;
}

.amazon-button-details {
    max-width: 100% !important;
}

.amazon-button {
    background-color: #232F3E;
    color: white !important;
    text-decoration: none;
    border: none;
    outline: none;
}

.amazon-button-details {
    background-color: #232F3E;
    color: white !important;
    border: none;
    outline: none;
}

.amazon-button:hover,
.amazon-button-details:hover {
    background-color: #131921;
    color: white !important;
    text-decoration: none;
}

.single_add_to_cart_button img,
.amazon-button img,
.amazon-button-details img {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    fill: white;
}

.add_to_cart_details_button {
    width: 100%;
    max-width: 100% !important;
    margin-top: -12px;
}

.print-button {
    margin-top: -12px;
    background: white;
    border: 1px solid black;
    color: black;
    border-radius: 5px !important;
    width: 100%;
}

.print-button:hover {
    background: black;
    color: white;
}

/* Product Meta */
.product_meta {
    display: flex;
    gap: 32px;
}

.single-product-top .product_meta > span {
    display: inline-block !important;
    text-transform: uppercase;
    font-size: 10pt;
    color: #d2d2d2;
}

.single-product-top .product_meta .sku_wrapper .label,
.single-product-top .product_meta .posted_in .label,
.single-product-top .product_meta .tagged_as .label {
    color: #d2d2d2;
    text-transform: uppercase;
    font-size: 10pt;
}

.pattern-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.pattern-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.pattern-card:hover {
    transform: translateY(-2px);
}

.pattern-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.pattern-info {
    padding: 15px;
}

.pattern-title {
    font-size: 14px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.pattern-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.pattern-download {
    background: #4CAF50;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    flex: 1;
    text-align: center;
    transition: background 0.2s ease;
}

.pattern-download:hover {
    background: #43A047;
    color: white;
}

.pattern-view {
    background: #f5f5f5;
    color: #333;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    flex: 1;
    text-align: center;
    transition: background 0.2s ease;
}

.pattern-view:hover {
    background: #e0e0e0;
    color: #333;
}

#preview-container {
    width: 1000px;
    aspect-ratio: 1;
    display: none;
}

.p-thumb{
    width: 129px;
    aspect-ratio: 1;
    background: #f5f5f5;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}
.preview-icon {
    width: 100%;
    height: 500px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.p-active-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid black;
}