/* ================================================================
   STOCKMASTER PRO V2.1 — design-enhanced.css
   Modern UI enhancements: cards, modals, buttons, forms, animations
   ================================================================ */

/* ── ENHANCED CARDS ──────────────────────────────────────────── */
.prod-card,
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.prod-card:hover,
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3), 
                0 0 0 1px var(--border-light);
}

.prod-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--green));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.prod-card:hover::before {
    opacity: 1;
}

/* Card header gradient */
.card-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 15px;
}

/* ── ENHANCED BUTTONS ─────────────────────────────────────────── */
.btn {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dim) 100%);
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--blue-dim) 0%, var(--blue) 100%);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dim) 100%);
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--green-dim) 0%, var(--green) 100%);
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dim) 100%);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--red-dim) 0%, var(--red) 100%);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
}

/* Button with icon */
.btn [data-icon],
.btn svg {
    transition: transform 0.3s ease;
}

.btn:hover [data-icon],
.btn:hover svg {
    transform: scale(1.1);
}

/* ── ENHANCED MODALS ──────────────────────────────────────────── */
#modalOverlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

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

#modalBox {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-light);
}

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

.modal-content {
    padding: 24px;
}

.modal-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

/* ── ENHANCED FORMS ───────────────────────────────────────────── */
.inp,
.sel,
textarea {
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.inp:focus,
.sel:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
    background: var(--bg-card);
}

.inp:hover,
.sel:hover,
textarea:hover {
    border-color: var(--border-light);
}

/* Floating labels effect */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group .inp,
.form-group .sel {
    padding-top: 20px;
    padding-bottom: 8px;
}

.form-group .lbl {
    position: absolute;
    left: 12px;
    top: 14px;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.3s ease;
    pointer-events: none;
    background: var(--bg-input);
    padding: 0 4px;
}

.form-group .inp:focus ~ .lbl,
.form-group .inp:not(:placeholder-shown) ~ .lbl,
.form-group .sel:focus ~ .lbl,
.form-group .sel:not([value=""]) ~ .lbl {
    top: -8px;
    left: 8px;
    font-size: 11px;
    color: var(--blue);
    font-weight: 600;
}

/* Input with icon */
.input-with-icon {
    position: relative;
}

.input-with-icon .inp {
    padding-left: 40px;
}

.input-with-icon::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-size: contain;
    opacity: 0.5;
}

/* ── BADGES & TAGS ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

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

.badge-red {
    background: var(--red-pale);
    color: var(--red);
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.badge-blue {
    background: var(--blue-pale);
    color: var(--blue);
    border: 1px solid rgba(0, 180, 216, 0.2);
}

.badge-orange {
    background: var(--orange-pale);
    color: var(--orange);
    border: 1px solid rgba(255, 123, 46, 0.2);
}

.badge-gray {
    background: rgba(136, 146, 164, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(136, 146, 164, 0.2);
}

/* Badge with icon animation */
.badge svg,
.badge [data-icon] {
    animation: pulse 2s ease-in-out infinite;
}

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

/* ── LOADING STATES ───────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--r);
}

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── TABLES ENHANCED ──────────────────────────────────────────── */
.tbl-wrap {
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: auto;
}

.tbl-wrap table {
    width: 100%;
    border-collapse: collapse;
}

.tbl-wrap thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table thead {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
}

table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border);
}

table tbody tr:hover {
    background: var(--bg-card-hover);
    transform: scale(1.005);
}

table tbody tr:last-child {
    border-bottom: none;
}

/* ── ALERTS & NOTIFICATIONS ──────────────────────────────────── */
.alert {
    padding: 16px 20px;
    border-radius: var(--r);
    border-left: 4px solid;
    background: var(--bg-card);
    margin-bottom: 16px;
    animation: slideInRight 0.4s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    border-left-color: var(--green);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--green-pale) 100%);
}

.alert-error {
    border-left-color: var(--red);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--red-pale) 100%);
}

.alert-warning {
    border-left-color: var(--orange);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--orange-pale) 100%);
}

.alert-info {
    border-left-color: var(--blue);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--blue-pale) 100%);
}

/* ── STATS CARDS (Dashboard) ─────────────────────────────────── */
.stat-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    padding: 20px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--blue-pale) 0%, transparent 70%);
    opacity: 0.3;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: var(--blue);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin: 8px 0;
    background: linear-gradient(135deg, var(--blue), var(--green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--green);
}

.stat-change.negative {
    color: var(--red);
}

/* ── PRODUCT GRID ENHANCED ───────────────────────────────────── */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 16px;
}

@media (max-width: 768px) {
    .prod-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}

.prod-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--r) var(--r) 0 0;
    transition: transform 0.3s ease;
}

.prod-card:hover .prod-img {
    transform: scale(1.05);
}

.prod-name {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.prod-card:hover .prod-name {
    color: var(--blue);
}

/* ── SEARCH ENHANCED ─────────────────────────────────────────── */
.inp-search {
    padding-left: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
}

.inp-search:focus {
    padding-left: 40px;
}

/* ── TRANSITIONS ─────────────────────────────────────────────── */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ── SCROLL ENHANCEMENTS ─────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ── TOOLTIPS ────────────────────────────────────────────────── */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ── RESPONSIVE IMPROVEMENTS ─────────────────────────────────── */
@media (max-width: 768px) {
    .modal-content {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ── PRINT ENHANCEMENTS ──────────────────────────────────────── */
@media print {
    .btn,
    .hdr-btn,
    .modal-actions,
    .app-footer {
        display: none !important;
    }
    
    .prod-card,
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
}

/* ── ACCESSIBILITY ───────────────────────────────────────────── */
.btn:focus-visible,
.inp:focus-visible,
.sel:focus-visible {
    outline: 2px solid var(--blue);
    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;
    }
}
