/* ============================================
   FAMILY HUB - REUSABLE COMPONENTS
   Common UI Components and Elements
   ============================================ */

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-decoration: none;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    will-change: transform;
}

/* Ripple effect */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out, opacity 0.6s ease-out;
    opacity: 0;
}

.btn:active::before {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: 0s;
}

/* Shimmer effect */
.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::after {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-2xl), var(--shadow-glow-primary);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
    transition: transform 0.1s;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-neutral-100);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: var(--gradient-emerald);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow-teal);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 20px rgba(239, 68, 68, 0.4);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

.btn-icon {
    padding: var(--space-3);
    aspect-ratio: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* === INPUT FIELDS === */
.form-group {
    position: relative;
    margin-bottom: var(--space-6);
}

.form-input {
    width: 100%;
    padding: var(--space-4) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-neutral-100);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    outline: none;
    transition: all var(--transition-base);
}

.form-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-primary-400);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
    color: var(--color-neutral-500);
}

/* Floating label */
.form-label {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-sm);
    color: var(--color-neutral-400);
    pointer-events: none;
    transition: all var(--transition-base);
    background: var(--color-primary-900);
    padding: 0 var(--space-2);
}

.form-input:focus~.form-label,
.form-input:not(:placeholder-shown)~.form-label {
    top: 0;
    font-size: var(--text-xs);
    color: var(--color-primary-400);
}

.form-error {
    color: var(--color-error);
    font-size: var(--text-xs);
    margin-top: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* === CARDS === */
.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-neutral-50);
    margin-bottom: var(--space-2);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--color-neutral-400);
}

.card-body {
    margin-bottom: var(--space-4);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Stat cards */
.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-extrabold);
    font-family: var(--font-heading);
    display: block;
    margin-bottom: var(--space-2);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--color-neutral-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === NAVIGATION === */
.navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 22, 40, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-3);
    z-index: var(--z-fixed);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.nav-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: var(--max-width-xl);
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    color: var(--color-neutral-400);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    transition: all var(--transition-base);
    border-radius: var(--radius-lg);
    min-width: 64px;
    position: relative;
}

.nav-item:hover {
    color: var(--color-primary-300);
    background: rgba(59, 130, 246, 0.1);
}

.nav-item.active {
    color: var(--color-primary-400);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.nav-icon {
    font-size: 24px;
    transition: transform var(--transition-base);
}

.nav-item:active .nav-icon {
    transform: scale(0.9);
}

/* Badge for notifications */
.nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: var(--color-error);
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

/* === PROGRESS INDICATORS === */
.progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: shimmer 2s infinite;
}

/* Circular progress */
.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.progress-circle-bar {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--transition-slow);
}

.progress-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    font-family: var(--font-heading);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-primary-300);
    border: 1px solid var(--color-primary-400);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-warning);
    border: 1px solid var(--color-warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
    padding: var(--space-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--color-primary-800);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-2xl);
    max-width: var(--max-width-md);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    transform: scale(0.9);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-neutral-50);
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-neutral-400);
    font-size: 24px;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-neutral-100);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    background: var(--color-primary-800);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--color-primary-400);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: start;
    gap: var(--space-3);
    pointer-events: all;
    animation: slideInRight var(--transition-base) ease-out;
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.warning {
    border-left-color: var(--color-warning);
}

.toast.error {
    border-left-color: var(--color-error);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
    color: var(--color-neutral-50);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--color-neutral-300);
}

/* === LOADING SPINNER === */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary-400);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

/* === CHECKBOX & RADIO === */
.checkbox,
.radio {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
}

.checkbox input,
.radio input {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-base);
}

.radio input {
    border-radius: 50%;
}

.checkbox input:checked,
.radio input:checked {
    background: var(--gradient-primary);
    border-color: var(--color-primary-400);
}

.checkbox input:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.radio input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* === AVATAR === */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
    border-width: 2px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    font-size: var(--text-2xl);
    border-width: 4px;
}

.avatar-xl {
    width: 120px;
    height: 120px;
    font-size: var(--text-3xl);
    border-width: 5px;
}

/* === DIVIDER === */
.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: var(--space-6) 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--color-neutral-400);
    font-size: var(--text-sm);
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: var(--space-6);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-3);
    color: var(--color-neutral-300);
}

.empty-state-message {
    font-size: var(--text-sm);
    color: var(--color-neutral-500);
    margin-bottom: var(--space-6);
}