/* Colorful Quote Boxes - Frontend Styles */

/* Base Quote Box Styles */
.cqb-quote-box {
    position: relative;
    display: block;
    word-wrap: break-word;
    overflow: hidden;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.cqb-quote-box:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Content Area */
.cqb-content {
    position: relative;
    z-index: 2;
}

/* Icons */
.cqb-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.2em;
    vertical-align: middle;
}

/* Pattern Overlays */
.cqb-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
}

/* Small Dots Pattern */
.cqb-pattern-dots-small {
    background-image: radial-gradient(circle at 2px 2px, currentColor 1px, transparent 0);
    background-size: 12px 12px;
    opacity: 0.1;
}

/* Large Dots Pattern */
.cqb-pattern-dots-large {
    background-image: radial-gradient(circle at 6px 6px, currentColor 3px, transparent 0);
    background-size: 24px 24px;
    opacity: 0.08;
}

/* Diagonal Lines Pattern */
.cqb-pattern-lines-diagonal {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 6px,
        currentColor 6px,
        currentColor 8px
    );
    opacity: 0.06;
}

/* Grid Lines Pattern */
.cqb-pattern-lines-grid {
    background-image: 
        linear-gradient(currentColor 1px, transparent 1px),
        linear-gradient(90deg, currentColor 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.08;
}

/* Geometric Pattern */
.cqb-pattern-geometric {
    background-image: 
        linear-gradient(45deg, currentColor 25%, transparent 25%),
        linear-gradient(-45deg, currentColor 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, currentColor 75%),
        linear-gradient(-45deg, transparent 75%, currentColor 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.06;
}

/* Subtle Texture Pattern */
.cqb-pattern-texture {
    background-image: 
        radial-gradient(circle at 25% 25%, currentColor 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, currentColor 1px, transparent 1px),
        radial-gradient(circle at 50% 10%, currentColor 0.5px, transparent 0.5px),
        radial-gradient(circle at 10% 90%, currentColor 0.5px, transparent 0.5px);
    background-size: 12px 12px, 12px 12px, 6px 6px, 6px 6px;
    background-position: 0 0, 6px 6px, 3px 3px, 9px 9px;
    opacity: 0.05;
}

/* Italics styling */
.cqb-quote-box.cqb-italics .cqb-content {
    font-style: italic;
}

/* Drag Handle (hidden on frontend by default) */
.cqb-drag-handle {
    display: none;
}

/* Editor-specific styles (when editing) */
.wp-admin .cqb-quote-box .cqb-drag-handle {
    display: block;
    position: absolute;
    top: 8px;
    right: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: grab;
    padding: 4px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    user-select: none;
    z-index: 3;
}

.wp-admin .cqb-quote-box:hover .cqb-drag-handle {
    color: rgba(255, 255, 255, 1);
    background: rgba(0, 0, 0, 0.2);
}

.wp-admin .cqb-drag-handle:active {
    cursor: grabbing;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cqb-quote-box {
        margin-left: 0;
        margin-right: 0;
        border-radius: 8px !important;
    }
    
    .cqb-content {
        font-size: 14px;
    }
    
    .cqb-icon {
        font-size: 1.1em;
    }
    
    /* Adjust patterns for smaller screens */
    .cqb-pattern-dots-small {
        background-size: 10px 10px;
    }
    
    .cqb-pattern-dots-large {
        background-size: 18px 18px;
    }
    
    .cqb-pattern-lines-grid {
        background-size: 18px 18px;
    }
    
    .cqb-pattern-geometric {
        background-size: 16px 16px;
        background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    }
}

@media (max-width: 480px) {
    .cqb-quote-box {
        padding: 15px !important;
        margin: 15px 0 !important;
        font-size: 14px !important;
    }
    
    .cqb-content {
        font-size: 13px;
    }
    
    /* Further reduce pattern complexity on very small screens */
    .cqb-pattern-dots-small {
        background-size: 8px 8px;
    }
    
    .cqb-pattern-dots-large {
        background-size: 14px 14px;
    }
    
    .cqb-pattern-geometric {
        background-size: 12px 12px;
        background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
    }
}

/* Print Styles */
@media print {
    .cqb-quote-box {
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .cqb-drag-handle {
        display: none !important;
    }
    
    .cqb-pattern {
        opacity: 0.03 !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .cqb-quote-box {
        border: 2px solid currentColor;
    }
    
    .cqb-pattern {
        opacity: 0.15;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .cqb-quote-box {
        transition: none;
    }
    
    .cqb-quote-box:hover {
        transform: none;
    }
    
    .cqb-drag-handle {
        transition: none;
    }
}

/* Accessibility Improvements */
.cqb-quote-box {
    /* Ensure sufficient color contrast */
    color: inherit;
}

.cqb-quote-box:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* RTL Support */
.rtl .cqb-icon {
    margin-right: 0;
    margin-left: 8px;
}

.rtl .cqb-drag-handle {
    right: auto;
    left: 8px;
}

/* Custom scrollbar for overflow content */
.cqb-quote-box::-webkit-scrollbar {
    width: 6px;
}

.cqb-quote-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.cqb-quote-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.cqb-quote-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Preset Style Classes (for easy application) */
.cqb-preset-warning {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52) !important;
    color: #ffffff !important;
}

.cqb-preset-success {
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    color: #ffffff !important;
}

.cqb-preset-info {
    background: linear-gradient(135deg, #2196F3, #1976D2) !important;
    color: #ffffff !important;
}

.cqb-preset-important {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2) !important;
    color: #ffffff !important;
}

.cqb-preset-highlight {
    background: linear-gradient(135deg, #ffeb3b, #ffc107) !important;
    color: #333333 !important;
}

/* Animation classes (for future use if needed) */
.cqb-animate-fade-in {
    animation: cqb-fade-in 0.5s ease-out;
}

@keyframes cqb-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sortable placeholder styles */
.cqb-sortable-container {
    position: relative;
}

.cqb-sort-placeholder {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 8px;
    height: 60px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-weight: 500;
}

.cqb-sort-placeholder:before {
    content: "Drop quote box here";
    font-size: 14px;
}

/* Dragging state */
.cqb-quote-box.ui-sortable-helper {
    opacity: 0.8;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: rotate(3deg);
    z-index: 1000;
}

.cqb-quote-box.ui-sortable-placeholder {
    opacity: 0.5;
    background: rgba(102, 126, 234, 0.1) !important;
    border: 2px dashed #667eea !important;
}