/* Kleurstalen Manager Frontend Styles - IMPROVED VERSION WITH RESPONSIVE BUTTONS */

/* Button Styles */
.ksm-button-wrapper {
    
}

.ksm-button-align-left { text-align: left; }
.ksm-button-align-center { text-align: center; }
.ksm-button-align-right { text-align: right; }

.ksm-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 14px !important;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-transform: uppercase;
}

.ksm-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Responsive button helpers */
.ksm-mobile-only {
    display: none !important;
}

.ksm-desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .ksm-mobile-only {
        display: inline-flex !important;
    }
    
    .ksm-desktop-only {
        display: none !important;
    }
    
    /* Smaller button on mobile if needed */
    .ksm-responsive-button {
        padding: 10px 12px;
        font-size: 13px !important;
    }
}

/* Button Styles */
.ksm-button-primary {
  background: #d96464;
  color: white;
}

.ksm-button-primary:hover {
    background: #fff;
    color:#d96464;
}

.ksm-button-secondary {
    background: #f5f5f5;
    color: #333;
    border-color: #ddd;
}

.ksm-button-secondary:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.ksm-button-outline {
    background: transparent;
    color: #333;
    border-color: #333;
}

.ksm-button-outline:hover {
    background: #333;
    color: white;
}

/* Button Sizes */
.ksm-button-small {
    padding: 8px 16px;
    font-size: 14px;
}

.ksm-button-medium {
    padding: 12px 24px;
    font-size: 16px;
}

.ksm-button-large {
    padding: 16px 32px;
    font-size: 18px;
}

/* IMPROVED Popup Styles - Better Centering */
.ksm-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px;
}

.ksm-popup.active {
    display: flex !important;
}

.ksm-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
}

.ksm-popup-container {
    position: relative !important;
    background: white !important;
    border-radius: 12px !important;
    max-width: 900px !important;
    width: 100% !important;
    max-height: 85vh !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 2 !important;
    margin: auto !important;
}

/* Body scroll lock */
body.ksm-popup-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

.ksm-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 24px;
    line-height: 1;
}

.ksm-popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.ksm-popup-close span {
    font-size: 24px;
    line-height: 1;
    color: #333;
}

/* Popup Steps */
.ksm-popup-step {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.ksm-popup-header {
    margin-bottom: 30px;
    text-align: center;
}

.ksm-popup-header h2 {
    font-size: 28px;
    margin: 0 0 10px 0;
    color: #333;
}

.ksm-popup-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.ksm-back-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.ksm-back-button:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Category Grid */
.ksm-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.ksm-category-card {
    background: #f9f9f9;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.ksm-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #333;
}

.ksm-category-placeholder {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    color: #333;
}

.ksm-category-placeholder svg {
    width: 40px;
    height: 40px;
}

.ksm-category-image {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    overflow: hidden;
    border-radius: 10px;
}

.ksm-category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ksm-category-card h3 {
    font-size: 20px;
    margin: 0 0 10px 0;
    color: #333;
}

.ksm-category-card p {
    font-size: 14px;
    color: #666;
    margin: 0 0 15px 0;
}

.ksm-category-count {
    display: inline-block;
    padding: 4px 12px;
    background: white;
    border-radius: 20px;
    font-size: 12px;
    color: #888;
}

/* Samples Grid */
.ksm-samples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.ksm-sample-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.ksm-sample-item:hover {
    border-color: #999;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ksm-sample-item.selected {
    border-color: #4CAF50;
    background: #f0fdf4;
}

.ksm-sample-item.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.ksm-sample-colors {
    height: 80px;
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.ksm-sample-color {
    width: 100%;
    height: 100%;
}

.ksm-sample-gradient {
    width: 100%;
    height: 100%;
}

.ksm-sample-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0 0 5px 0;
}

.ksm-sample-sku {
    font-size: 12px;
    color: #999;
}

.ksm-sample-price {
    font-size: 14px;
    font-weight: bold;
    color: #4CAF50;
    margin-top: 5px;
}

.ksm-sample-popular {
    position: absolute;
    top: 10px;
    left: 10px;
    background: gold;
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

/* Popup Footer */
.ksm-popup-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    gap: 20px;
    flex-wrap: wrap;
}

.ksm-selection-info {
    font-size: 16px;
    color: #666;
    padding: 10px 0;
    margin-right: auto;
}

.ksm-selected-count {
    font-weight: bold;
    color: #333;
    font-size: 18px;
}

.ksm-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ksm-btn-primary {
    background: #333;
    color: white;
}

.ksm-btn-primary:hover:not(:disabled) {
    background: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ksm-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.ksm-btn-secondary {
    background: white;
    color: #333;
    border: 2px solid #ddd;
}

.ksm-btn-secondary:hover {
    background: #f5f5f5;
}

/* IMPROVED Cart Content */
.ksm-cart-content {
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.ksm-cart-items {
    padding: 10px 0;
}

.ksm-cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.ksm-cart-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.ksm-cart-item-color {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.ksm-cart-item-info {
    flex: 1;
    text-align: left;
}

.ksm-cart-item-title {
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
    font-size: 16px;
}

.ksm-cart-item-sku {
    font-size: 12px;
    color: #999;
    margin-bottom: 3px;
}

.ksm-cart-item-price {
    font-size: 14px;
    color: #4CAF50;
    font-weight: bold;
}

.ksm-cart-item-remove {
    width: 30px;
    height: 30px;
    border: none;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ksm-cart-item-remove:hover {
    background: #cc0000;
    transform: rotate(90deg);
}

.ksm-cart-summary {
    padding: 15px;
    background: #f0f0f0;
    border-radius: 8px;
    margin-top: 20px;
}

.ksm-cart-total {
    font-size: 18px;
    color: #333;
}

.ksm-cart-actions {
    display: flex;
    gap: 10px;
}

/* Loading State */
.ksm-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
}

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

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

.ksm-loading p {
    margin-top: 20px;
    color: #666;
    font-size: 16px;
}

/* Notification */
.ksm-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: right 0.3s ease;
    z-index: 1000000;
}

.ksm-notification.show {
    right: 20px;
}

.ksm-notification-icon {
    width: 30px;
    height: 30px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.ksm-notification-message {
    color: #333;
    font-size: 16px;
}

/* Grid Layout */
.ksm-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.ksm-grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ksm-grid-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ksm-grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.ksm-grid-5 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.ksm-grid-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.ksm-grid-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.ksm-color-preview {
    height: 150px;
    position: relative;
}

.ksm-color-gradient,
.ksm-color-solid {
    width: 100%;
    height: 100%;
}

.ksm-sample-info {
    padding: 15px;
}

.ksm-sample-info h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.ksm-sku {
    display: inline-block;
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.ksm-description {
    margin: 10px 0 0 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.ksm-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.ksm-badge-popular {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

/* Responsive */
@media (max-width: 768px) {
    .ksm-popup-container {
        width: 95%;
        max-height: 90vh;
        margin: 10px;
    }
    
    .ksm-category-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .ksm-samples-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .ksm-popup-step {
        padding: 20px;
    }
    
    .ksm-popup-header h2 {
        font-size: 24px;
    }
    
    /* Verbeterde footer layout voor mobiel */
    .ksm-popup-footer {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .ksm-selection-info {
        width: 100%;
        text-align: center;
        padding: 15px;
        background: white;
        border-radius: 8px;
        margin: 0 0 10px 0;
        border: 1px solid #e0e0e0;
    }
    
    #ksm-add-to-cart {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        margin: 0;
    }
    
    .ksm-cart-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .ksm-cart-total {
        width: 100%;
        text-align: center;
        padding: 15px;
        background: white;
        border-radius: 8px;
        margin: 0 0 10px 0;
    }
    
    .ksm-btn {
        width: 100%;
    }
    
    .ksm-grid-2,
    .ksm-grid-3,
    .ksm-grid-4,
    .ksm-grid-5 {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}