/**
 * @fileoverview Component Styles for Rantii
 * @author retoor <retoor@molodetz.nl>
 * @description Styles for all UI components
 * @keywords css, components, ui, styles
 */

loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.spinner-circle {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small .spinner-circle {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-large .spinner-circle {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.spinner-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

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

toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 400px;
}

toast-notification {
    display: block;
    animation: slideIn 0.3s ease;
}

toast-notification.toast-hiding {
    animation: slideOut 0.3s ease forwards;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
}

.toast-success .toast-content { border-left-color: var(--color-success); }
.toast-error .toast-content { border-left-color: var(--color-error); }
.toast-warning .toast-content { border-left-color: var(--color-warning); }
.toast-info .toast-content { border-left-color: var(--color-info); }

.toast-icon {
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-info); }

.toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
}

.toast-close {
    flex-shrink: 0;
    color: var(--color-text-muted);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
}

.toast-close:hover {
    color: var(--color-text);
    background-color: var(--color-surface-hover);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

user-avatar {
    display: inline-block;
}

.avatar-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.avatar-small .avatar-wrapper {
    width: 32px;
    height: 32px;
}

.avatar-medium .avatar-wrapper {
    width: 48px;
    height: 48px;
}

.avatar-large .avatar-wrapper {
    width: 80px;
    height: 80px;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials {
    color: white;
    font-weight: 600;
}

.avatar-small .avatar-initials { font-size: var(--font-size-xs); }
.avatar-medium .avatar-initials { font-size: var(--font-size-md); }
.avatar-large .avatar-initials { font-size: var(--font-size-xl); }

vote-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.vote-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.vote-btn:hover {
    background-color: var(--color-surface-hover);
}

.vote-btn.upvote:hover,
.vote-btn.upvote.active {
    color: var(--color-upvote);
}

.vote-btn.downvote:hover,
.vote-btn.downvote.active {
    color: var(--color-downvote);
}

.vote-score {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.vote-score.positive { color: var(--color-upvote); }
.vote-score.negative { color: var(--color-downvote); }

theme-selector {
    display: block;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.theme-option:hover {
    background-color: var(--color-surface-hover);
}

.theme-option.active {
    border-color: var(--color-primary);
}

.theme-preview {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.theme-preview-dark { background: linear-gradient(135deg, #1a1a2e 50%, #e94560 50%); }
.theme-preview-light { background: linear-gradient(135deg, #f5f5f7 50%, #d63651 50%); }
.theme-preview-black { background: linear-gradient(135deg, #000000 50%, #e94560 50%); }
.theme-preview-white { background: linear-gradient(135deg, #ffffff 50%, #c52d47 50%); }
.theme-preview-ocean { background: linear-gradient(135deg, #0a1929 50%, #5090d3 50%); }
.theme-preview-forest { background: linear-gradient(135deg, #0d1f0d 50%, #4caf50 50%); }
.theme-preview-sunset { background: linear-gradient(135deg, #1f1410 50%, #ff7043 50%); }

.theme-name {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.theme-label {
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

image-preview {
    display: block;
}

.image-container {
    position: relative;
    max-width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--color-bg-tertiary);
}

.preview-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

.gif-badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: var(--radius-sm);
}

.expand-btn {
    position: absolute;
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.image-container:hover .expand-btn {
    opacity: 1;
}

image-lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

image-lightbox.lightbox-visible {
    opacity: 1;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background-color: var(--color-overlay);
}

.lightbox-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: var(--radius-full);
}

.lightbox-close:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

youtube-embed {
    display: block;
    max-width: 100%;
}

.youtube-preview {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background-color: var(--color-bg-tertiary);
}

.youtube-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.youtube-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    padding: 0;
    transition: transform var(--transition-fast);
}

.youtube-preview:hover .youtube-play {
    transform: translate(-50%, -50%) scale(1.1);
}

.youtube-badge {
    position: absolute;
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    background-color: #ff0000;
    color: white;
    border-radius: var(--radius-sm);
}

.youtube-player {
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.youtube-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

link-preview {
    display: block;
}

.link-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.link-card:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-primary);
    text-decoration: none;
}

.link-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-title {
    display: block;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-domain {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.link-external {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

@media (max-width: 480px) {
    toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
        max-width: none;
    }
}
