/**
 * Frontend CSS for HD SofT AI Summary
 *
 * @package HDSofT\AISummary
 */

/* Summary Container */
.hdsoft-ai-summary-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Theme-adaptive width constraints */
    width: 100%;
    max-width: var(--content-width, 90%);
    box-sizing: border-box;
}

/* Support for WordPress 6.x CSS variables */
@supports (width: var(--wp--style--global--content-size)) {
    .hdsoft-ai-summary-container {
        max-width: var(--wp--style--global--content-size, 90%);
    }
}

/* Theme-specific content width variables */
.hdsoft-ai-summary-container {
    max-width: var(--wp--style--global--wide-size, var(--content-width, 90%));
}

.hdsoft-ai-summary-container.hdsoft-ai-summary-before {
    margin-bottom: 30px;
    margin-top: 0;
}

.hdsoft-ai-summary-container.hdsoft-ai-summary-after {
    margin-top: 30px;
    margin-bottom: 0;
}

/* Summary Title */
.hdsoft-ai-summary-title {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

/* Summary Content */
.hdsoft-ai-summary-content {
    line-height: 1.6;
    color: #555;
    font-size: 16px;
}

.hdsoft-ai-summary-content p {
    margin: 0 0 15px 0;
}

.hdsoft-ai-summary-content p:last-child {
    margin-bottom: 0;
}

/* Branding */
.hdsoft-ai-summary-branding {
    margin: 15px 0 0 0;
    text-align: right;
    opacity: 0.7;
}

.hdsoft-ai-summary-branding small {
    font-size: 12px;
    color: #666;
}

.hdsoft-ai-summary-branding a {
    color: #007cba;
    text-decoration: none;
}

.hdsoft-ai-summary-branding a:hover {
    text-decoration: underline;
}

/* Shortcode Specific Styles */
.hdsoft-ai-summary {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .hdsoft-ai-summary-container,
    .hdsoft-ai-summary {
        padding: 15px;
        margin: 15px 0;
        border-radius: 6px;
    }
    
    .hdsoft-ai-summary-title {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .hdsoft-ai-summary-content {
        font-size: 15px;
    }
}

@media screen and (max-width: 480px) {
    .hdsoft-ai-summary-container,
    .hdsoft-ai-summary {
        padding: 12px;
        margin: 12px 0;
    }
    
    .hdsoft-ai-summary-title {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .hdsoft-ai-summary-content {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* Theme Compatibility */
.entry-content .hdsoft-ai-summary-container,
.post-content .hdsoft-ai-summary-container,
.content .hdsoft-ai-summary-container {
    max-width: 100%;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .hdsoft-ai-summary-container,
    .hdsoft-ai-summary {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .hdsoft-ai-summary-title {
        color: #f7fafc;
        border-bottom-color: #63b3ed;
    }
    
    .hdsoft-ai-summary-content {
        color: #cbd5e0;
    }
    
    .hdsoft-ai-summary-branding small {
        color: #a0aec0;
    }
    
    .hdsoft-ai-summary-branding a {
        color: #63b3ed;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .hdsoft-ai-summary-container,
    .hdsoft-ai-summary {
        border-width: 2px;
        border-color: #000;
    }
    
    .hdsoft-ai-summary-title {
        border-bottom-width: 3px;
        border-bottom-color: #000;
    }
}

/* Print Styles */
@media print {
    .hdsoft-ai-summary-container,
    .hdsoft-ai-summary {
        background: transparent !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
    
    .hdsoft-ai-summary-branding {
        display: none;
    }
}

/* Animation for Dynamic Loading */
.hdsoft-ai-summary-loading {
    opacity: 0.6;
    position: relative;
}

.hdsoft-ai-summary-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: hdsoft-summary-spin 1s linear infinite;
}

@keyframes hdsoft-summary-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fade In Animation */
.hdsoft-ai-summary-fade-in {
    animation: hdsoft-summary-fade-in 0.5s ease-in-out;
}

@keyframes hdsoft-summary-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus States for Accessibility */
.hdsoft-ai-summary-container:focus,
.hdsoft-ai-summary:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Custom Theme Overrides */
.hdsoft-ai-summary-theme-minimal {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.hdsoft-ai-summary-theme-minimal .hdsoft-ai-summary-title {
    border-bottom: 1px solid #ddd;
    font-size: 1em;
    margin-bottom: 10px;
    padding-bottom: 5px;
}

.hdsoft-ai-summary-theme-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hdsoft-ai-summary-theme-highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.hdsoft-ai-summary-theme-highlight .hdsoft-ai-summary-title {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.hdsoft-ai-summary-theme-highlight .hdsoft-ai-summary-content {
    color: rgba(255, 255, 255, 0.9);
}

.hdsoft-ai-summary-theme-highlight .hdsoft-ai-summary-branding small {
    color: rgba(255, 255, 255, 0.7);
}

.hdsoft-ai-summary-theme-highlight .hdsoft-ai-summary-branding a {
    color: #fff;
}

/* RTL Support */
.rtl .hdsoft-ai-summary-branding {
    text-align: left;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .hdsoft-ai-summary-fade-in,
    .hdsoft-ai-summary-loading::after {
        animation: none;
    }
}
