/* ================================================
   NEXUS Property OS - Shared UI Components
   Premium Dubai Property Management Platform
   ================================================ */

/* ================================================
   CSS Custom Properties
   ================================================ */
:root {
    --nexus-gold: #D4AF37;
    --nexus-gold-dark: #B8941F;
    --nexus-gold-light: #F4E4B5;
    --nexus-navy: #0A1628;
    --nexus-navy-medium: #1a2942;
    --nexus-navy-light: #2d3e5f;
    --nexus-teal: #00D4AA;
    --nexus-teal-dark: #00a88a;
    --nexus-pearl: #FAFAF9;
    --nexus-sand: #F5F2ED;
    --nexus-error: #ef4444;
    --nexus-warning: #f59e0b;
    --nexus-success: #10b981;
    --nexus-info: #3b82f6;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-gold: 0 10px 30px rgba(212, 175, 55, 0.3);
}

/* ================================================
   Loading Spinners
   ================================================ */
.nexus-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    position: relative;
}

.nexus-spinner::before,
.nexus-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.nexus-spinner::before {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(212, 175, 55, 0.2);
}

.nexus-spinner::after {
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--nexus-gold);
    animation: nexus-spin 0.8s linear infinite;
}

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

/* Spinner Sizes */
.nexus-spinner-sm {
    width: 20px;
    height: 20px;
}

.nexus-spinner-lg {
    width: 60px;
    height: 60px;
}

/* Dubai-inspired Geometric Spinner */
.nexus-spinner-geometric {
    width: 50px;
    height: 50px;
    position: relative;
}

.nexus-spinner-geometric::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--nexus-gold);
    transform: rotate(45deg);
    animation: geometric-rotate 2s ease-in-out infinite;
}

.nexus-spinner-geometric::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border: 2px solid var(--nexus-teal);
    border-radius: 50%;
    animation: geometric-pulse 2s ease-in-out infinite;
}

@keyframes geometric-rotate {
    0%, 100% { transform: rotate(45deg) scale(1); }
    50% { transform: rotate(225deg) scale(0.9); }
}

@keyframes geometric-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.5; }
}

/* ================================================
   Page Loading Overlay
   ================================================ */
.nexus-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--nexus-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.nexus-page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.nexus-page-loader .loader-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--nexus-gold), var(--nexus-gold-dark));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--nexus-navy);
    margin-bottom: 2rem;
    animation: logo-pulse 2s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 30px 10px rgba(212, 175, 55, 0.2); }
}

.nexus-page-loader .loader-text {
    color: var(--nexus-gold);
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 1rem;
}

.nexus-page-loader .loader-bar {
    width: 200px;
    height: 3px;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.nexus-page-loader .loader-bar::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--nexus-gold), var(--nexus-teal));
    animation: loader-bar-move 1.5s ease-in-out infinite;
}

@keyframes loader-bar-move {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ================================================
   Skeleton Loading
   ================================================ */
.nexus-skeleton {
    background: linear-gradient(90deg,
        rgba(26, 41, 66, 0.6) 25%,
        rgba(45, 62, 95, 0.6) 50%,
        rgba(26, 41, 66, 0.6) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.nexus-skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.nexus-skeleton-text:last-child {
    width: 60%;
}

.nexus-skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.nexus-skeleton-card {
    height: 200px;
}

/* ================================================
   Toast Notifications
   ================================================ */
.nexus-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nexus-toast {
    background: rgba(26, 41, 66, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-lg);
    animation: toast-slide-in 0.3s ease;
    transition: all 0.3s ease;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.nexus-toast.toast-exit {
    transform: translateX(100%);
    opacity: 0;
}

.nexus-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nexus-toast-success .nexus-toast-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--nexus-success);
}

.nexus-toast-error .nexus-toast-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--nexus-error);
}

.nexus-toast-warning .nexus-toast-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--nexus-warning);
}

.nexus-toast-info .nexus-toast-icon {
    background: rgba(59, 130, 246, 0.2);
    color: var(--nexus-info);
}

.nexus-toast-content {
    flex: 1;
}

.nexus-toast-title {
    color: #fff;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.nexus-toast-message {
    color: #94a3b8;
    font-size: 0.875rem;
}

.nexus-toast-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.nexus-toast-close:hover {
    color: var(--nexus-gold);
}

/* ================================================
   Button Styles
   ================================================ */
.nexus-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    position: relative;
    overflow: hidden;
}

.nexus-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nexus-btn:hover::before {
    left: 100%;
}

.nexus-btn-primary {
    background: linear-gradient(135deg, var(--nexus-gold), var(--nexus-gold-dark));
    color: var(--nexus-navy);
}

.nexus-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
    color: var(--nexus-navy);
}

.nexus-btn-secondary {
    background: rgba(0, 212, 170, 0.1);
    border: 2px solid var(--nexus-teal);
    color: var(--nexus-teal);
}

.nexus-btn-secondary:hover {
    background: rgba(0, 212, 170, 0.2);
    transform: translateY(-2px);
    color: var(--nexus-teal);
}

.nexus-btn-outline {
    background: transparent;
    border: 2px solid rgba(212, 175, 55, 0.3);
    color: var(--nexus-gold);
}

.nexus-btn-outline:hover {
    border-color: var(--nexus-gold);
    background: rgba(212, 175, 55, 0.1);
}

.nexus-btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.nexus-btn-loading .nexus-spinner {
    width: 18px;
    height: 18px;
}

/* Button Sizes */
.nexus-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.nexus-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ================================================
   Card Styles
   ================================================ */
.nexus-card {
    background: rgba(26, 41, 66, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.nexus-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.nexus-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

.nexus-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: #fff;
    margin: 0;
}

.nexus-card-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(0, 212, 170, 0.1));
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nexus-gold);
    font-size: 1.25rem;
}

/* ================================================
   Badge Styles
   ================================================ */
.nexus-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nexus-badge-gold {
    background: rgba(212, 175, 55, 0.2);
    color: var(--nexus-gold);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.nexus-badge-teal {
    background: rgba(0, 212, 170, 0.2);
    color: var(--nexus-teal);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.nexus-badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--nexus-success);
}

.nexus-badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--nexus-warning);
}

.nexus-badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--nexus-error);
}

/* ================================================
   Form Inputs
   ================================================ */
.nexus-input {
    width: 100%;
    background: rgba(15, 30, 50, 0.6);
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    color: #fff;
    font-size: 0.95rem;
    font-family: 'Cairo', sans-serif;
    transition: all var(--transition-normal);
}

.nexus-input:focus {
    outline: none;
    border-color: var(--nexus-gold);
    background: rgba(15, 30, 50, 0.8);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.nexus-input::placeholder {
    color: #64748b;
}

.nexus-input-error {
    border-color: var(--nexus-error);
}

.nexus-input-success {
    border-color: var(--nexus-success);
}

.nexus-input-group {
    position: relative;
}

.nexus-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nexus-gold);
}

.nexus-input-group .nexus-input {
    padding-left: 3rem;
}

/* ================================================
   Tooltips
   ================================================ */
.nexus-tooltip {
    position: relative;
    display: inline-block;
}

.nexus-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--nexus-navy-medium);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.nexus-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

/* ================================================
   Progress Bars
   ================================================ */
.nexus-progress {
    height: 8px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.nexus-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--nexus-gold), var(--nexus-teal));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ================================================
   Animations
   ================================================ */
.nexus-fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.nexus-slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nexus-scale-in {
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hover lift effect */
.nexus-hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.nexus-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ================================================
   Empty States
   ================================================ */
.nexus-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.nexus-empty-state-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(0, 212, 170, 0.05));
    border: 2px dashed rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: var(--nexus-gold);
}

.nexus-empty-state-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.nexus-empty-state-message {
    color: #94a3b8;
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* ================================================
   Print Styles
   ================================================ */
@media print {
    .nexus-no-print {
        display: none !important;
    }

    .nexus-card {
        border: 1px solid #ddd;
        box-shadow: none;
        break-inside: avoid;
    }

    body {
        background: #fff;
        color: #000;
    }

    a {
        text-decoration: none;
        color: inherit;
    }
}

/* ================================================
   Accessibility
   ================================================ */
.nexus-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nexus-focus-visible:focus-visible {
    outline: 2px solid var(--nexus-gold);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
