/* ============================================
   6. KPI / STAT CARDS
   ============================================ */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform var(--duration) var(--ease-spring),
                border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    animation: cardEnter var(--duration-enter) var(--ease-out-expo) both;
}

.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 60ms; }
.card:nth-child(3) { animation-delay: 120ms; }
.card:nth-child(4) { animation-delay: 180ms; }
.card:nth-child(5) { animation-delay: 240ms; }

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

.card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    background: var(--brand-gradient);
    transition: opacity var(--duration) var(--ease);
    pointer-events: none;
    z-index: 0;
}

.card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: var(--brand-glow);
}

.card:active {
    transform: translateY(-2px) scale(0.99);
    transition-duration: var(--duration-fast);
}

.card:hover::after {
    opacity: 0.04;
}

.card > * {
    position: relative;
    z-index: 1;
}

.card .icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    background: var(--brand-muted);
    transition: transform var(--duration) var(--ease-spring),
                box-shadow var(--duration) var(--ease);
}

.card:hover .icon {
    transform: scale(1.1) rotate(-4deg);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.card .icon i {
    font-size: 20px;
    color: var(--brand);
    transition: transform var(--duration) var(--ease-spring);
}

.card:hover .icon i {
    transform: scale(1.15);
}

/* Card color variants via nth-child */
.card:nth-child(2) .icon { background: var(--success-muted); }
.card:nth-child(2) .icon i { color: var(--success); }
.card:nth-child(3) .icon { background: var(--warning-muted); }
.card:nth-child(3) .icon i { color: var(--warning); }
.card:nth-child(4) .icon { background: var(--info-muted); }
.card:nth-child(4) .icon i { color: var(--info); }
.card:nth-child(5) .icon { background: var(--danger-muted); }
.card:nth-child(5) .icon i { color: var(--danger); }

.card .number {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    transition: color var(--duration-fast) var(--ease);
}

.card:hover .number {
    color: var(--brand-hover);
}

.card .label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   7. GROWTH SECTION
   ============================================ */
.growth {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    animation: cardEnter var(--duration-enter) var(--ease-out-expo) both;
    animation-delay: 300ms;
    transition: border-color var(--duration) var(--ease);
}

.growth:hover {
    border-color: var(--border-interactive);
}

.growth h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.growth h2::before {
    content: '';
    width: 4px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    flex-shrink: 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 8px;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast) var(--ease),
                transform var(--duration-fast) var(--ease);
}

.stat-row:hover {
    background: var(--surface-interactive);
    transform: translateX(4px);
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-row > div:first-child {
    flex: 1;
    margin-right: 20px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--brand);
    min-width: 56px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    transition: text-shadow var(--duration) var(--ease);
}

.stat-row:hover .stat-value {
    text-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.progress-bar {
    height: 6px;
    background: var(--surface-sunken);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    transition: width 1s var(--ease-out-expo);
    position: relative;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.progress-bar-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: progressShimmer 2.5s infinite;
}

@keyframes progressShimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   8. DATA TABLES
   ============================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    font-size: 14px;
    animation: cardEnter var(--duration-enter) var(--ease-out-expo) both;
    animation-delay: 100ms;
}

th, td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

th {
    background: var(--surface-raised);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

td {
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background var(--duration-fast) var(--ease),
                box-shadow var(--duration-fast) var(--ease);
    position: relative;
}

tbody tr:hover {
    background: var(--surface-interactive-hover);
}

tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}

/* ============================================
   9. BUTTONS
   ============================================ */
.add-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--brand-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration) var(--ease);
    margin-bottom: 20px;
    margin-right: 8px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.add-main::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s var(--ease);
}

.add-main:hover::after {
    transform: translateX(100%);
}

.add-main:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.add-main:active {
    transform: translateY(0) scale(0.97);
    transition-duration: var(--duration-fast);
}

/* Action buttons */
.actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.actions button {
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    transition: all var(--duration-fast) var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.actions button:hover {
    transform: scale(1.08);
}

.actions button:active {
    transform: scale(0.94);
    transition-duration: 80ms;
}

.actions button.edit {
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
    background: var(--success-muted);
}

.actions button.edit:hover {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    box-shadow: var(--success-glow);
}

.actions button.delete {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
    background: var(--danger-muted);
}

.actions button.delete:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: var(--danger-glow);
}

.actions button.add {
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.3);
    background: var(--info-muted);
}

.actions button.add:hover {
    background: var(--info);
    color: #fff;
    border-color: var(--info);
    box-shadow: var(--info-glow);
}

/* ============================================
   10. STATUS BADGES
   ============================================ */
.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-spring);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.status-toggle::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-toggle:hover {
    filter: brightness(1.15);
    transform: scale(1.05);
}

.status-toggle:active {
    transform: scale(0.95);
}

.status-approved, .status-read {
    background: var(--success-muted);
    color: var(--success);
}

.status-approved::before, .status-read::before {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-pending, .status-unread {
    background: var(--warning-muted);
    color: var(--warning);
}

.status-pending::before, .status-unread::before {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

/* ============================================
   11. MODALS
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration) var(--ease);
    z-index: 1000;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 440px;
    transform: scale(0.95) translateY(16px);
    opacity: 0;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-xl);
}

.modal.show .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
    transition: all var(--duration-slow) var(--ease-spring);
}

.modal-content h3,
.modal-content h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-content label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="file"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 16px;
    transition: border-color var(--duration-fast) var(--ease),
                box-shadow var(--duration-fast) var(--ease),
                background var(--duration-fast) var(--ease);
}

.modal-content input:hover,
.modal-content select:hover,
.modal-content textarea:hover {
    border-color: var(--border-strong);
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring-brand);
    background: rgba(99, 102, 241, 0.03);
}

.modal-content textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-content button {
    width: 100%;
    padding: 11px 20px;
    background: var(--brand-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow var(--duration-fast) var(--ease),
                transform var(--duration-fast) var(--ease-spring);
    margin-top: 4px;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.modal-content button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s var(--ease);
}

.modal-content button:hover::after {
    transform: translateX(100%);
}

.modal-content button:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.modal-content button:active {
    transform: translateY(0) scale(0.97);
}

/* ============================================
   12. FILTER BAR
   ============================================ */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--surface-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
    animation: cardEnter var(--duration-enter) var(--ease-out-expo) both;
    animation-delay: 50ms;
}

.filters:focus-within {
    border-color: var(--border-interactive);
    box-shadow: 0 0 0 3px var(--brand-50);
}

.filters label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.filters select,
.filters input[type="text"] {
    padding: 9px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    min-width: 140px;
    transition: border-color var(--duration-fast) var(--ease),
                box-shadow var(--duration-fast) var(--ease),
                background var(--duration-fast) var(--ease);
}

.filters select:hover,
.filters input[type="text"]:hover {
    border-color: var(--border-strong);
}

.filters select:focus,
.filters input[type="text"]:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring-brand);
    background: rgba(99, 102, 241, 0.03);
}

/* ============================================
   13. COLUMNS / LIST VIEW (Dictionary page)
   ============================================ */
.column {
    flex: 1;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 460px;
    max-height: 540px;
    margin-right: 16px;
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.column:hover {
    border-color: var(--border-interactive);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.column:last-child {
    margin-right: 0;
}

.column h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.column input,
.column select {
    padding: 9px 12px;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 10px;
    transition: border-color var(--duration-fast) var(--ease),
                box-shadow var(--duration-fast) var(--ease),
                background var(--duration-fast) var(--ease);
    width: 100%;
}

.column input:hover,
.column select:hover {
    border-color: var(--border-strong);
}

.column input:focus,
.column select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring-brand);
    background: rgba(99, 102, 241, 0.03);
}

.list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.list > div {
    padding: 11px 14px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-spring);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    -webkit-tap-highlight-color: transparent;
}

.list > div:hover {
    background: var(--surface-card-hover);
    border-color: var(--border-default);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.list > div.active {
    background: var(--brand-muted);
    border-left: 3px solid var(--brand);
    color: var(--brand-hover);
    box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.05);
}

.list > div:active {
    transform: translateX(2px) scale(0.99);
}

.list div p {
    margin: 2px 0;
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
}

.list div p span {
    font-weight: 600;
    color: var(--brand-hover) !important;
    margin-right: 4px;
}

/* ============================================
   14. PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.pagination button {
    padding: 9px 18px;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
}

.pagination button:hover:not(:disabled) {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.pagination button:active:not(:disabled) {
    transform: translateY(0) scale(0.95);
}

.pagination button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.pagination span {
    padding: 9px 16px;
    background: var(--brand-muted);
    border-radius: var(--radius-sm);
    color: var(--brand-hover);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(99, 102, 241, 0.2);
    transition: box-shadow var(--duration) var(--ease);
}

.pagination span:hover {
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

/* ============================================
   15. AUDIO PLAYER
   ============================================ */
audio {
    width: 100%;
    max-width: 200px;
    height: 34px;
    border-radius: var(--radius-sm);
}

/* ============================================
   16. TREE VIEW (Properties page)
   ============================================ */
.tree-indent {
    padding-left: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.toggle-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-spring);
    font-size: 12px;
    color: var(--text-muted);
    -webkit-tap-highlight-color: transparent;
}

.toggle-btn:hover {
    background: var(--brand-muted);
    color: var(--brand);
    transform: scale(1.15);
}

.toggle-btn:active {
    transform: scale(0.9);
}

.parent-row td {
    font-weight: 500;
}

.child-row {
    background: rgba(255, 255, 255, 0.015);
    transition: background var(--duration-fast) var(--ease);
}

.child-row:hover {
    background: rgba(99, 102, 241, 0.04);
}

.hidden-row {
    display: none;
}

/* ============================================
   17. TOAST NOTIFICATIONS
   ============================================ */
.Jirlee_contct-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.5s var(--ease-spring);
    z-index: 1100;
    overflow: hidden;
}

.Jirlee_contct-toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    animation: toastProgress 4s linear forwards;
    border-radius: 0 2px 0 0;
}

@keyframes toastSlideIn {
    0% {
        opacity: 0;
        transform: translateX(80px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateX(-8px) scale(1.02);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ============================================
   18. ERROR MESSAGE
   ============================================ */
.error-message {
    background: var(--danger-muted);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: errorShake 0.5s var(--ease) both;
}

.error-message i {
    animation: errorPulse 2s ease-in-out infinite;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

@keyframes errorPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   19. VALIDATION
   ============================================ */
.validation-message {
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    animation: validationAppear 0.3s var(--ease-out-expo) both;
}

@keyframes validationAppear {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.invalid {
    outline: none;
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}
