/**
 * CODDB Chat Customization - Modern UI Overhaul 
 * Enhanced styling to match admin panel design system
 * Date: 2025-07-08 21:30
 */

/* ==========================================
   CUSTOMIZATION MAIN CONTAINER
   ========================================== */

.coddb-customization-content {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    margin: 0;
}

/* ==========================================
   CUSTOMIZATION HEADER BAR
   ========================================== */

.coddb-customization-header {
    background: linear-gradient(135deg, rgba(255, 105, 0, 0.1), rgba(255, 105, 0, 0.05));
    border-bottom: 2px solid rgba(255, 105, 0, 0.3);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.coddb-customization-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary, #ff6900);
    text-shadow: 0 0 10px rgba(255, 105, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.coddb-customization-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.coddb-customization-sync-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.coddb-customization-sync-status.synced {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.coddb-customization-sync-status.syncing {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.coddb-customization-sync-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================
   CUSTOMIZATION TABS SYSTEM
   ========================================== */

.coddb-customization-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 105, 0, 0.2);
    overflow-x: auto;
}

.coddb-customization-tab {
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    position: relative;
    min-width: fit-content;
}

.coddb-customization-tab:hover {
    color: #fff;
    background: rgba(255, 105, 0, 0.1);
}

.coddb-customization-tab.active {
    color: var(--color-primary, #ff6900);
    background: rgba(255, 105, 0, 0.15);
    border-bottom-color: var(--color-primary, #ff6900);
}

.coddb-customization-tab-icon {
    font-size: 16px;
}

/* ==========================================
   CUSTOMIZATION CONTENT AREA
   ========================================== */

.coddb-customization-body {
    padding: 25px;
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 105, 0, 0.5) rgba(0, 0, 0, 0.1);
}

.coddb-customization-body::-webkit-scrollbar {
    width: 8px;
}

.coddb-customization-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.coddb-customization-body::-webkit-scrollbar-thumb {
    background: rgba(255, 105, 0, 0.5);
    border-radius: 4px;
}

.coddb-customization-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 105, 0, 0.7);
}

.coddb-customization-tab-content {
    display: none;
}

.coddb-customization-tab-content.active {
    display: block;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   FEATURE CARDS SYSTEM
   ========================================== */

.coddb-feature-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.coddb-feature-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 105, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.coddb-feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary, #ff6900), #ff8533);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.coddb-feature-card:hover {
    border-color: rgba(255, 105, 0, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 105, 0, 0.15);
}

.coddb-feature-card:hover::before {
    opacity: 1;
}

.coddb-feature-card.enabled {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.05);
}

.coddb-feature-card.enabled::before {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    opacity: 1;
}

/* ==========================================
   FEATURE CARD HEADER
   ========================================== */

.coddb-feature-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.coddb-feature-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.coddb-feature-card-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 105, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.coddb-feature-card h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.coddb-feature-card-description {
    color: #999;
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.3;
}

/* ==========================================
   MODERN TOGGLE SWITCH
   ========================================== */

.coddb-feature-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.coddb-feature-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.coddb-feature-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    border-radius: 28px;
}

.coddb-feature-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.coddb-feature-toggle input:checked + .coddb-feature-toggle-slider {
    background: var(--color-primary, #ff6900);
    border-color: var(--color-primary, #ff6900);
    box-shadow: 0 0 10px rgba(255, 105, 0, 0.4);
}

.coddb-feature-toggle input:checked + .coddb-feature-toggle-slider:before {
    transform: translateX(24px);
    background: #fff;
}

/* ==========================================
   FEATURE CONTROLS
   ========================================== */

.coddb-feature-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.coddb-feature-control-group {
    margin-bottom: 12px;
}

.coddb-feature-control-group:last-child {
    margin-bottom: 0;
}

.coddb-feature-control-label {
    display: block;
    color: #ccc;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coddb-feature-control-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    transition: all 0.3s ease;
}

.coddb-feature-control-input:focus {
    outline: none;
    border-color: var(--color-primary, #ff6900);
    box-shadow: 0 0 0 2px rgba(255, 105, 0, 0.2);
}

.coddb-feature-control-input[type="color"] {
    height: 36px;
    padding: 2px;
    cursor: pointer;
}

.coddb-feature-control-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.coddb-feature-control-select:focus {
    outline: none;
    border-color: var(--color-primary, #ff6900);
    box-shadow: 0 0 0 2px rgba(255, 105, 0, 0.2);
}

/* ==========================================
   LIVE PREVIEW SECTION
   ========================================== */

.coddb-live-preview-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 105, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
}

.coddb-live-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.coddb-live-preview-header h4 {
    margin: 0;
    color: var(--color-primary, #ff6900);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coddb-live-preview-controls {
    display: flex;
    gap: 10px;
}

.coddb-preview-btn {
    padding: 6px 12px;
    background: rgba(255, 105, 0, 0.1);
    border: 1px solid rgba(255, 105, 0, 0.3);
    border-radius: 6px;
    color: var(--color-primary, #ff6900);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.coddb-preview-btn:hover {
    background: rgba(255, 105, 0, 0.2);
    transform: translateY(-1px);
}

.coddb-live-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.coddb-preview-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
}

.coddb-preview-box h5 {
    margin: 0 0 10px 0;
    color: #ccc;
    font-size: 14px;
    font-weight: 500;
}

.coddb-preview-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   QUICK ACTIONS BAR
   ========================================== */

.coddb-customization-actions {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 105, 0, 0.2);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.coddb-customization-actions-left,
.coddb-customization-actions-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.coddb-action-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}

.coddb-action-btn-primary {
    background: var(--color-primary, #ff6900);
    color: #fff;
}

.coddb-action-btn-primary:hover {
    background: #e55a00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 105, 0, 0.3);
}

.coddb-action-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.2);
}

.coddb-action-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.coddb-action-btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.coddb-action-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
    .coddb-customization-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .coddb-customization-tabs {
        flex-direction: column;
    }
    
    .coddb-feature-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .coddb-live-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .coddb-customization-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .coddb-customization-actions-left,
    .coddb-customization-actions-right {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================
   LOADING & STATES
   ========================================== */

.coddb-customization-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.coddb-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 105, 0, 0.2);
    border-top: 3px solid var(--color-primary, #ff6900);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.coddb-feature-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.coddb-feature-locked {
    position: relative;
}

.coddb-feature-locked::after {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    opacity: 0.7;
}

/* ==========================================
   ANIMATION EFFECTS
   ========================================== */

.coddb-feature-card.updated {
    animation: featureUpdated 0.6s ease-out;
}

@keyframes featureUpdated {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.coddb-preview-content.updating {
    animation: previewUpdate 0.5s ease-in-out;
}

@keyframes previewUpdate {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}
