/*
 * NYSC Design System v3 — Molecules
 * Premium composed components with world-class animations
 */

/* ── Form Group ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; position: relative; }
.form-group label {
    font-weight: var(--font-weight-semi); font-size: var(--font-size-sm);
    color: var(--clr-text-muted); margin-bottom: 5px;
}
.form-group:focus-within > label { color: var(--clr-primary); }
.form-group .help-block {
    font-size: var(--font-size-xs); color: var(--clr-text-muted); margin-top: 5px;
}
.form-group.has-error  .form-control {
    border-color: var(--clr-danger);
    box-shadow: 0 0 0 4px var(--clr-danger-glow), 0 0 0 6px rgba(192,57,43,0.06);
}
.form-group.has-error  label   { color: var(--clr-danger); }
.form-group.has-error  .help-block { color: var(--clr-danger); }
.form-group.has-success .form-control {
    border-color: var(--clr-success);
    box-shadow: 0 0 0 4px rgba(39,174,96,0.20), 0 0 0 6px rgba(39,174,96,0.06);
}
.form-group.has-warning .form-control {
    border-color: var(--clr-warning);
    box-shadow: 0 0 0 4px var(--clr-warning-glow), 0 0 0 6px rgba(224,123,0,0.06);
}

.input-group-addon {
    background: var(--clr-surface-alt);
    border-color: var(--clr-input-border);
    color: var(--clr-text-muted);
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    transition: border-color var(--t-fast);
}

/* ── Search Bar ──────────────────────────────────────────────────────── */
.nysc-search { position: relative; display: flex; align-items: center; }
.nysc-search input {
    padding-left: 42px !important;
    border-radius: var(--radius-pill) !important;
    background: var(--clr-surface) !important;
}
.nysc-search input:focus { transform: none; }
.nysc-search .nysc-search-icon {
    position: absolute; left: 15px;
    color: var(--clr-text-faint); pointer-events: none;
    font-size: 14px; transition: color var(--t-fast);
}
.nysc-search:focus-within .nysc-search-icon { color: var(--clr-primary); }

/* ══════════════════════════════════════════════════════════════════════
   STAT TILES — Premium 3D perspective tilt with glass morphism
   ══════════════════════════════════════════════════════════════════════ */

@keyframes nysc-count-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Perspective wrapper applied to the tile itself */
.nysc-stat-tile {
    background: var(--clr-card-bg);
    border: 1px solid var(--clr-card-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    perspective: 800px;
    /* Diagonal gradient overlay */
    background-image:
        linear-gradient(
            135deg,
            var(--clr-primary-xlight) 0%,
            transparent 55%
        );
    transition:
        box-shadow var(--t-base),
        transform var(--t-bounce),
        border-color var(--t-base);
    animation: nysc-count-in 0.55s var(--ease-out) both;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

/* Large decorative circle — ::before */
.nysc-stat-tile::before {
    content: '';
    position: absolute;
    top: -10px; right: -10px;
    width: 110px; height: 110px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(61,122,66,0.14) 0%,
        rgba(61,122,66,0.04) 60%,
        transparent 100%
    );
    transform: translate(20px,-20px);
    transition: transform var(--t-slow), opacity var(--t-slow);
    pointer-events: none;
    z-index: 0;
}

/* Smaller second decorative element — ::after */
.nysc-stat-tile::after {
    content: '';
    position: absolute;
    bottom: -14px; left: -14px;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(7,148,212,0.10) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
    transition: transform var(--t-slow);
}

.nysc-stat-tile:hover {
    box-shadow: var(--shadow-card-hover), var(--shadow-glow-lg);
    transform: perspective(800px) rotateY(-3deg) rotateX(2deg) translateY(-6px);
    border-color: rgba(61,122,66,0.18);
}
.nysc-stat-tile:hover::before {
    transform: translate(8px,-8px) scale(1.3);
    opacity: 0.85;
}
.nysc-stat-tile:hover::after {
    transform: translate(-4px, 4px) scale(1.2);
}

/* Icon */
.nysc-stat-tile-icon {
    width: 58px; height: 58px;
    border-radius: var(--radius-md);
    background: var(--clr-primary-xlight);
    color: var(--clr-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
    transition: background var(--t-base), transform var(--t-bounce), color var(--t-base),
                box-shadow var(--t-base);
    position: relative; z-index: 1;
    box-shadow: 0 2px 8px rgba(61,122,66,0.15);
}
.nysc-stat-tile:hover .nysc-stat-tile-icon {
    background: var(--grad-primary);
    color: #fff;
    transform: rotate(-10deg) scale(1.18);
    box-shadow: 0 6px 20px rgba(61,122,66,0.40);
}
.nysc-stat-tile-icon.accent  { background: rgba(7,148,212,0.12);  color: var(--clr-accent);  box-shadow: 0 2px 8px rgba(7,148,212,0.15); }
.nysc-stat-tile-icon.warning { background: rgba(224,123,0,0.12);  color: var(--clr-warning); box-shadow: 0 2px 8px rgba(224,123,0,0.15); }
.nysc-stat-tile-icon.danger  { background: rgba(192,57,43,0.12);  color: var(--clr-danger);  box-shadow: 0 2px 8px rgba(192,57,43,0.15); }
.nysc-stat-tile:hover .nysc-stat-tile-icon.accent  { background: var(--grad-accent);   color: #fff; box-shadow: 0 6px 20px rgba(7,148,212,0.40); }
.nysc-stat-tile:hover .nysc-stat-tile-icon.warning { background: var(--grad-warning);  color: #fff; box-shadow: 0 6px 20px rgba(224,123,0,0.40); }
.nysc-stat-tile:hover .nysc-stat-tile-icon.danger  { background: var(--grad-danger);   color: #fff; box-shadow: 0 6px 20px rgba(192,57,43,0.40); }

/* Value — gradient text */
.nysc-stat-tile-value {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 3px;
    position: relative; z-index: 1;
    background: var(--grad-text-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.nysc-stat-tile-label {
    font-size: var(--font-size-xs); color: var(--clr-text-muted);
    text-transform: uppercase; letter-spacing: 0.7px;
    font-weight: var(--font-weight-semi);
    position: relative; z-index: 1;
}

/* ── Info Row ────────────────────────────────────────────────────────── */
.nysc-info-row {
    display: flex; gap: var(--space-sm);
    padding: 10px 4px;
    border-bottom: 1px solid var(--clr-border);
    align-items: baseline;
    transition: background var(--t-fast);
    border-radius: var(--radius-sm);
}
.nysc-info-row:last-child { border-bottom: none; }
.nysc-info-row:hover { background: var(--clr-surface-alt); }
.nysc-info-label {
    font-weight: var(--font-weight-semi); color: var(--clr-text-muted);
    font-size: var(--font-size-sm); min-width: 160px; flex-shrink: 0;
}
.nysc-info-value { color: var(--clr-text); font-size: var(--font-size-sm); word-break: break-word; }

/* ── Breadcrumb ──────────────────────────────────────────────────────── */
.breadcrumb { background: transparent; padding: 0; margin: 0; font-size: var(--font-size-sm); }
.breadcrumb > li + li::before { color: var(--clr-text-faint); }
.breadcrumb > li > a { color: var(--clr-primary); }
.breadcrumb > li > a:hover { color: var(--clr-primary-dark); }
.breadcrumb > .active { color: var(--clr-text); }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 2px solid var(--clr-border); }
.nav-tabs > li > a {
    color: var(--clr-text-muted);
    border: none !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: var(--font-size-sm); font-weight: var(--font-weight-semi);
    padding: 11px 20px;
    transition: color var(--t-fast), background var(--t-fast);
    position: relative;
}
.nav-tabs > li > a::after {
    content: '';
    position: absolute; bottom: -2px; left: 0; right: 0;
    height: 2px;
    background: var(--grad-primary);
    transform: scaleX(0); transition: transform var(--t-base);
    border-radius: 2px 2px 0 0;
}
.nav-tabs > li > a:hover { background: var(--clr-primary-xlight); color: var(--clr-primary); }
.nav-tabs > li > a:hover::after { transform: scaleX(0.6); }
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover {
    background: var(--clr-card-bg); color: var(--clr-primary);
    border-bottom: 2px solid var(--clr-card-bg) !important;
}
.nav-tabs > li.active > a::after { transform: scaleX(1); }
.tab-content {
    padding: var(--space-md); background: var(--clr-card-bg);
    border: 1px solid var(--clr-border); border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: nysc-page-in 0.3s var(--ease-out);
}
@keyframes nysc-page-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Pills ───────────────────────────────────────────────────────────── */
.nav-pills > li > a {
    border-radius: var(--radius-md); color: var(--clr-text);
    font-size: var(--font-size-sm); font-weight: var(--font-weight-semi);
    transition: all var(--t-fast);
}
.nav-pills > li > a:hover { background: var(--clr-primary-xlight); color: var(--clr-primary); }
.nav-pills > li.active > a,
.nav-pills > li.active > a:hover {
    background: var(--grad-primary); color: #fff;
    box-shadow: var(--shadow-btn-primary);
}

/* ── List Group ──────────────────────────────────────────────────────── */
.list-group { border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.list-group-item {
    background: var(--clr-card-bg); border-color: var(--clr-border);
    color: var(--clr-text); font-size: var(--font-size-sm);
    transition: background var(--t-fast), padding-left var(--t-fast), color var(--t-fast);
    border-left: 3px solid transparent;
}
.list-group-item:hover {
    background: var(--clr-primary-xlight);
    padding-left: 22px; border-left-color: var(--clr-primary);
    color: var(--clr-primary);
}
.list-group-item.active,
.list-group-item.active:hover {
    background: var(--grad-primary); border-color: transparent;
    border-left-color: var(--clr-primary-dark); color: #fff;
}

/* ══════════════════════════════════════════════════════════════════════
   SECTION HEADER — Gradient text on headings
   ══════════════════════════════════════════════════════════════════════ */
.nysc-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--clr-primary);
    margin-bottom: var(--space-lg);
    position: relative;
}
.nysc-section-header::after {
    content: '';
    position: absolute; bottom: -2px; left: 0;
    width: 50px; height: 2px;
    background: var(--grad-accent);
    border-radius: var(--radius-pill);
}
.nysc-section-header h3,
.nysc-section-header h4 {
    margin: 0;
    font-weight: var(--font-weight-bold);
    /* Gradient text on section headings */
    background: var(--grad-text-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}
.nysc-section-header .section-actions { display: flex; gap: var(--space-sm); }

/* ── Filter Row ──────────────────────────────────────────────────────── */
.nysc-filter-row {
    display: flex; flex-wrap: wrap; gap: var(--space-sm);
    align-items: flex-end; padding: var(--space-md);
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-xs);
}
.nysc-filter-row .form-group { margin-bottom: 0; flex: 1; min-width: 130px; }

/* ══════════════════════════════════════════════════════════════════════
   STATUS INDICATOR — Dramatic animated pulse dots
   ══════════════════════════════════════════════════════════════════════ */

@keyframes nysc-dot-pulse {
    0%, 100% { transform: scale(1);   opacity: 1;   box-shadow: 0 0 0 0 currentColor; }
    40%       { transform: scale(1.6); opacity: 0.9; box-shadow: 0 0 0 4px rgba(39,174,96,0); }
    70%       { transform: scale(1.3); opacity: 0.7; }
}
@keyframes nysc-dot-pulse-warning {
    0%, 100% { transform: scale(1);   opacity: 1; }
    40%       { transform: scale(1.6); opacity: 0.9; }
    70%       { transform: scale(1.3); opacity: 0.7; }
}

.nysc-status {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 11px; font-weight: var(--font-weight-semi);
    padding: 4px 12px; border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
}
.nysc-status::before {
    content: ''; width: 8px; height: 8px;
    border-radius: 50%; flex-shrink: 0;
}

.nysc-status-active {
    background: var(--clr-badge-success-bg);
    color: var(--clr-badge-success-text);
    box-shadow: 0 1px 4px rgba(39,174,96,0.18);
}
.nysc-status-active::before {
    background: var(--clr-success);
    box-shadow: 0 0 6px rgba(39,174,96,0.60);
    animation: nysc-dot-pulse 1.8s ease-in-out infinite;
}

.nysc-status-pending {
    background: var(--clr-badge-warning-bg);
    color: var(--clr-badge-warning-text);
    box-shadow: 0 1px 4px rgba(224,123,0,0.15);
}
.nysc-status-pending::before {
    background: var(--clr-warning);
    box-shadow: 0 0 6px rgba(224,123,0,0.50);
    animation: nysc-dot-pulse-warning 1.2s ease-in-out infinite;
}

.nysc-status-inactive {
    background: var(--clr-badge-danger-bg);
    color: var(--clr-badge-danger-text);
}
.nysc-status-inactive::before {
    background: var(--clr-danger);
}

/* ══════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS — Glassmorphism variant
   ══════════════════════════════════════════════════════════════════════ */

@keyframes nysc-toast-in {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes nysc-toast-out {
    from { transform: translateX(0);    opacity: 1; max-height: 80px; }
    to   { transform: translateX(110%); opacity: 0; max-height: 0; }
}

.nysc-toast-container {
    position: fixed; top: 72px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: var(--space-sm);
}

.nysc-toast {
    min-width: 290px; max-width: 390px;
    padding: 15px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    display: flex; align-items: flex-start; gap: 12px;
    animation: nysc-toast-in 0.4s var(--ease-bounce);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

/* Glassmorphism toast variant */
.nysc-toast-glass {
    background: var(--clr-glass);
    border: 1px solid var(--clr-glass-border);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: var(--shadow-lg), var(--shadow-glow-lg);
}

.nysc-toast-success {
    background: var(--clr-badge-success-bg);
    color: var(--clr-badge-success-text);
    border-left-color: var(--clr-success);
}
.nysc-toast-warning {
    background: var(--clr-badge-warning-bg);
    color: var(--clr-badge-warning-text);
    border-left-color: var(--clr-warning);
}
.nysc-toast-danger {
    background: var(--clr-badge-danger-bg);
    color: var(--clr-badge-danger-text);
    border-left-color: var(--clr-danger);
}
.nysc-toast-info {
    background: var(--clr-badge-info-bg);
    color: var(--clr-badge-info-text);
    border-left-color: var(--clr-accent);
}

/* ── Dark mode for molecules ─────────────────────────────────────────── */
[data-theme="dark"] .nysc-stat-tile {
    background-image: linear-gradient(
        135deg,
        rgba(106,184,112,0.06) 0%,
        transparent 55%
    );
}
[data-theme="dark"] .nysc-stat-tile::before {
    background: radial-gradient(
        circle,
        rgba(106,184,112,0.12) 0%,
        rgba(106,184,112,0.03) 60%,
        transparent 100%
    );
}
[data-theme="dark"] .nysc-stat-tile::after {
    background: radial-gradient(
        circle,
        rgba(74,184,238,0.08) 0%,
        transparent 70%
    );
}
[data-theme="dark"] .nysc-toast-glass {
    background: var(--clr-glass);
    border-color: var(--clr-glass-border);
}
