/* Gatherly UI Component Library — shadcn/ui inspired styles */

:root {
    --background: #ffffff;
    --foreground: #0f172a;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --primary: #1a56db;
    --primary-foreground: #ffffff;
    --secondary: #f1f5f9;
    --secondary-foreground: #1e293b;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #f1f5f9;
    --accent-foreground: #1e293b;
    --destructive: #ef4444;
    --destructive-foreground: #ffffff;
    --success: #22c55e;
    --success-foreground: #ffffff;
    --warning: #f59e0b;
    --warning-foreground: #ffffff;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #1a56db;
    --radius: 0.5rem;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Button ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}
.btn-default {
    background: var(--primary);
    color: var(--primary-foreground);
}
.btn-default:hover {
    background: #1e40af;
}
.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: #e2e8f0;
}
.btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}
.btn-destructive:hover {
    background: #dc2626;
}
.btn-outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}
.btn-outline:hover {
    background: var(--accent);
}
.btn-ghost {
    background: transparent;
    color: var(--foreground);
}
.btn-ghost:hover {
    background: var(--accent);
}
.btn-link {
    background: transparent;
    color: var(--primary);
    text-decoration: underline;
    border: none;
    padding: 0;
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}
.btn-lg {
    padding: 0.625rem 1.5rem;
    font-size: 1rem;
}
.btn-icon {
    padding: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
}

/* ===== Card ===== */
.card {
    background: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.card-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    margin: 0;
}
.card-description {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0;
}
.card-content {
    padding: 1.5rem;
}
.card-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    transition: colors 0.15s ease;
}
.badge-default {
    background: var(--primary);
    color: var(--primary-foreground);
}
.badge-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}
.badge-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}
.badge-success {
    background: var(--success);
    color: var(--success-foreground);
}
.badge-warning {
    background: var(--warning);
    color: var(--warning-foreground);
}
.badge-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

/* ===== Input ===== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}
.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    line-height: 1.25rem;
    background: var(--background);
    color: var(--foreground);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: var(--font-sans);
    box-sizing: border-box;
}
.input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.2);
}
.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.input-error {
    border-color: var(--destructive);
}
.input-error:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
.input-error-message {
    font-size: 0.8125rem;
    color: var(--destructive);
}

/* ===== Select ===== */
.select-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    font-family: var(--font-sans);
    box-sizing: border-box;
}
.select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.2);
}

/* ===== Textarea ===== */
.textarea-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    resize: vertical;
    font-family: var(--font-sans);
    box-sizing: border-box;
}
.textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.2);
}

/* ===== Table ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: var(--muted-foreground);
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:hover {
    background: var(--muted);
}

/* ===== Tabs ===== */
.tabs {
    width: 100%;
}
.tab-list {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0;
}
.tab-trigger {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
}
.tab-trigger:hover {
    color: var(--foreground);
}
.tab-trigger.active {
    color: var(--foreground);
    border-bottom-color: var(--primary);
}
.tab-content {
    padding-top: 1rem;
}

/* ===== Dialog ===== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 0.15s ease;
}
.dialog {
    background: var(--background);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 32rem;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.15s ease;
}
.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0;
}
.dialog-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}
.dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0;
    line-height: 1;
}
.dialog-close:hover {
    color: var(--foreground);
}
.dialog-content {
    padding: 1.5rem;
}
.dialog-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    animation: slideInRight 0.2s ease;
    min-width: 20rem;
    max-width: 28rem;
}
.toast-default {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--foreground);
}
.toast-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}
.toast-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}
.toast-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}
.toast-content {
    flex: 1;
}
.toast-message {
    font-size: 0.875rem;
}
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: inherit;
    opacity: 0.5;
}
.toast-close:hover {
    opacity: 1;
}

/* ===== Loading / Skeleton ===== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
}
.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.loading-message {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}
.skeleton {
    background: linear-gradient(90deg, var(--muted) 25%, #e8eef4 50%, var(--muted) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius);
    animation: shimmer 1.5s infinite;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
