/**
 * File: /assets/css/frontend.css
 * Description: Frontend styles for AI Share buttons and containers.
 *
 * Provides responsive styling for all layout options and sizes.
 * Uses CSS custom properties for easy customization.
 */

/* CSS Custom Properties for theming */
:root {
    --ai-share-primary-color: #2563eb;
    --ai-share-hover-color: #1d4ed8;
    --ai-share-text-color: #374151;
    --ai-share-bg-color: #f9fafb;
    --ai-share-border-color: #e5e7eb;
    --ai-share-border-radius: 8px;
    --ai-share-transition: all 0.2s ease-in-out;
    --ai-share-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --ai-share-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Main Container */
.ai-share-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.ai-share-container * {
    box-sizing: border-box;
}

/* Label */
.ai-share-label {
    color: var(--ai-share-text-color);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Buttons Container */
.ai-share-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Individual Button Base Styles */
.ai-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background-color: #6b7280;
    border: 1px solid #6b7280;
    border-radius: var(--ai-share-border-radius);
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    transition: var(--ai-share-transition);
    box-shadow: var(--ai-share-shadow);
    cursor: pointer;
    white-space: nowrap;
}

.ai-share-button:hover,
.ai-share-button:focus {
    background-color: var(--ai-share-primary-color);
    border-color: var(--ai-share-primary-color);
    color: white;
    text-decoration: none;
    box-shadow: var(--ai-share-shadow-hover);
    transform: translateY(-1px);
}

.ai-share-button:focus {
    outline: 2px solid var(--ai-share-primary-color);
    outline-offset: 2px;
}

.ai-share-button:active {
    transform: translateY(0);
    box-shadow: var(--ai-share-shadow);
}

/* Icon Styles - Match original site exactly */
.ai-share-button .icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    flex-shrink: 0;
    cursor: default;
    display: inline-block;
}
/* Inline SVGs adopt the button’s text color (white on brand backgrounds) */
.ai-share-button svg.icon {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0;
}

/* Font Awesome icon specific styles */
.ai-share-button .icon.fa,
.ai-share-button .icon.fas,
.ai-share-button .icon.far,
.ai-share-button .icon.fab {
    width: auto;
    height: auto;
    font-size: 18px;
    line-height: 1;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* SVG icons */
.ai-share-button svg.icon {
    display: inline-block;
    vertical-align: middle;
}

/* Text Styles */
.ai-share-text {
    font-size: inherit;
    font-weight: inherit;
}

/* Layout Styles */

/* Horizontal Layout (Default) */
.ai-share-style-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}

.ai-share-style-horizontal .ai-share-buttons {
    flex-direction: row;
    flex-wrap: wrap;
}

/* Vertical Layout */
.ai-share-style-vertical {
    flex-direction: column;
    align-items: flex-start;
}

.ai-share-style-vertical .ai-share-buttons {
    flex-direction: column;
    width: 100%;
}

.ai-share-style-vertical .ai-share-button {
    justify-content: flex-start;
    width: 100%;
    max-width: 200px;
}

/* Grid Layout */
.ai-share-style-grid .ai-share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.ai-share-style-grid .ai-share-button {
    justify-content: center;
}

/* Size Variations */

/* Small Size */
.ai-share-size-small .ai-share-button {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

.ai-share-size-small .icon {
    width: 14px;
    height: 14px;
}

.ai-share-size-small .icon.fa,
.ai-share-size-small .icon.fas,
.ai-share-size-small .icon.far,
.ai-share-size-small .icon.fab {
    font-size: 14px;
}

.ai-share-size-small .ai-share-label {
    font-size: 0.75rem;
}

/* Medium Size (Default) */
.ai-share-size-medium .ai-share-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.ai-share-size-medium .ai-share-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Large Size */
.ai-share-size-large .ai-share-button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.ai-share-size-large .icon {
    width: 24px;
    height: 24px;
}

.ai-share-size-large .icon.fa,
.ai-share-size-large .icon.fas,
.ai-share-size-large .icon.far,
.ai-share-size-large .icon.fab {
    font-size: 24px;
}

.ai-share-size-large .ai-share-label {
    font-size: 1rem;
}

/* Platform-Specific Styling */
/* Perplexity: black on white */
.ai-share-perplexity { background:#20808D; border-color:#20808D; color:#fff; }

/* Grok / X: black */
.ai-share-grok { background:#000; border-color:#000; color:#fff; }
.ai-share-grok:hover, .ai-share-grok:focus { background:#111 !important; border-color:#111 !important; }

/* ChatGPT: #10A37F already matches */
.ai-share-chatgpt { background:#10a37f; border-color:#10a37f; color:#fff; }

/* Google: blue base is fine; icon is multicolor inside SVG */

/* Google brand */
.ai-share-google_ai { background:#4285f4; border-color:#4285f4; color:#fff; }
.ai-share-google_ai:hover,
.ai-share-google_ai:focus { background:#3367d6; border-color:#3367d6; color:#fff; }

/* Claude brand - Anthropic's signature color */
.ai-share-claude { background:#CC785C; border-color:#CC785C; color:#fff; }
.ai-share-claude:hover,
.ai-share-claude:focus { background:#B86A4F; border-color:#B86A4F; color:#fff; }

.ai-share-chatgpt:hover,
.ai-share-chatgpt:focus {
    background-color: #10a37f;
    border-color: #10a37f;
}

.ai-share-perplexity:hover,
.ai-share-perplexity:focus { background:#BADEDD; border-color:#BADEDD; }

.ai-share-grok:hover,
.ai-share-grok:focus { background:#111; border-color:#111; }

.ai-share-google_ai:hover,
.ai-share-google_ai:focus {
    background-color: #3367d6;
    border-color: #3367d6;
    color: white;
}

.ai-share-gemini {
    background-color: #4285f4 !important;
    border-color: #4285f4 !important;
    color: white;
}

.ai-share-gemini:hover,
.ai-share-gemini:focus {
    background-color: #3367d6;
    border-color: #3367d6;
    color: white;
}

/* Force white logos for black buttons when icons are <img> files */
.ai-share-perplexity img.icon,
.ai-share-grok img.icon {
    filter: invert(1) brightness(2) contrast(1);
}


/* Icon-only mode (when labels are hidden) */
.ai-share-container:not(:has(.ai-share-text)) .ai-share-button {
    padding: 0.5rem;
    min-width: auto;
}

.ai-share-size-small .ai-share-container:not(:has(.ai-share-text)) .ai-share-button {
    padding: 0.375rem;
}

.ai-share-size-large .ai-share-container:not(:has(.ai-share-text)) .ai-share-button {
    padding: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-share-style-horizontal {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ai-share-style-horizontal .ai-share-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .ai-share-style-horizontal .ai-share-button {
        justify-content: flex-start;
        width: 100%;
        max-width: 200px;
    }
    
    .ai-share-style-grid .ai-share-buttons {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .ai-share-container {
        margin: 0.75rem 0;
    }
    
    .ai-share-style-grid .ai-share-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .ai-share-button {
        font-size: 0.75rem;
    }
    
    .ai-share-size-large .ai-share-button {
        font-size: 0.875rem;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .ai-share-button {
        transition: none;
    }
    
    .ai-share-button:hover {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ai-share-button {
        border-width: 2px;
    }
    
    .ai-share-button:focus {
        outline-width: 3px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --ai-share-text-color: #f3f4f6;
        --ai-share-bg-color: #374151;
        --ai-share-border-color: #4b5563;
    }
}

/* Print Styles */
@media print {
    .ai-share-container {
        display: none;
    }
}

/* Loading State (for future use) */
.ai-share-button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.ai-share-button.loading .ai-share-icon {
    animation: ai-share-spin 1s linear infinite;
}

@keyframes ai-share-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Custom CSS Integration Point */
/* Users can override these styles or add their own below this line */