/* Modern CSS Reset & Variable Definitions */
:root {
    --bg-dark: #0f0c1b;
    --bg-card: rgba(30, 25, 50, 0.65);
    --bg-card-hover: rgba(45, 38, 72, 0.85);
    --border-gold: rgba(212, 175, 55, 0.25);
    --border-gold-hover: rgba(212, 175, 55, 0.6);
    --text-primary: #f5f2eb;
    --text-muted: #a69bb0;
    --royal-gold: #e5c158;
    --royal-red: #c83b50;
    --royal-red-hover: #e04a62;
    --royal-green: #3bc888;
    --royal-blue: #3b88c8;
    --font-outfit: 'Outfit', sans-serif;
    --font-cinzel: 'Cinzel', serif;
    --shadow-premium: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-outfit);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Ambient Background Glows */
.bg-glow {
    position: fixed;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.15;
}
.bg-glow-1 {
    top: -20%;
    left: -10%;
    background: radial-gradient(circle, var(--royal-red) 0%, transparent 70%);
}
.bg-glow-2 {
    bottom: -20%;
    right: -10%;
    background: radial-gradient(circle, var(--royal-gold) 0%, transparent 70%);
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--royal-gold);
}

/* Layout Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Header & Brand styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-gold);
    padding-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--royal-gold), #b38b1b);
    color: #110d21;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 8px 20px rgba(229, 193, 88, 0.3);
    animation: pulseGlow 3s infinite ease-in-out;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-cinzel);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(to right, #ffffff, var(--royal-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.stats-overview {
    display: flex;
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: 16px;
    padding: 0.8rem 1.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    border-color: var(--border-gold-hover);
    transform: translateY(-3px);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--royal-gold);
}

.stat-value.warning {
    color: var(--royal-red);
}

/* Toolbar & Filter Controls */
.toolbar-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: rgba(20, 15, 35, 0.5);
    padding: 1.2rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-box input {
    width: 100%;
    background: rgba(10, 8, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.9rem 1rem 0.9rem 2.8rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-outfit);
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--royal-gold);
    box-shadow: 0 0 15px rgba(229, 193, 88, 0.2);
}

.filter-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.7rem 1.3rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-outfit);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition-smooth);
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--royal-gold);
    color: var(--royal-gold);
}

/* Premium Buttons */
.btn {
    padding: 0.8rem 1.6rem;
    border-radius: 12px;
    font-family: var(--font-outfit);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition-smooth);
    border: none;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--royal-red), #932232);
    color: white;
    box-shadow: 0 6px 20px rgba(200, 59, 80, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--royal-red-hover), var(--royal-red));
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(200, 59, 80, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-add {
    font-size: 0.95rem;
}

/* Card Grid Styles */
.inventory-section {
    min-height: 400px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* Premium Product Cards */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: 20px;
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--royal-red), var(--royal-gold));
    opacity: 0.7;
    transition: var(--transition-smooth);
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-gold-hover);
    background: var(--bg-card-hover);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.15);
}

.product-card:hover::before {
    opacity: 1;
    height: 6px;
}

/* Card Tags */
.card-header-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.category-badge {
    padding: 0.35rem 0.8rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-beauty {
    background: rgba(224, 74, 98, 0.15);
    border: 1px solid var(--royal-red);
    color: var(--royal-red-hover);
}

.badge-food {
    background: rgba(59, 200, 136, 0.15);
    border: 1px solid var(--royal-green);
    color: var(--royal-green);
}

.badge-alcohol {
    background: rgba(59, 136, 200, 0.15);
    border: 1px solid var(--royal-blue);
    color: var(--royal-blue);
}

.stock-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.stock-indicator.danger {
    color: var(--royal-red-hover);
    animation: blink 2s infinite ease-in-out;
}

.stock-indicator.warning {
    color: #f7a631;
}

.stock-indicator.safe {
    color: var(--royal-green);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-danger { background-color: var(--royal-red-hover); }
.dot-warning { background-color: #f7a631; }
.dot-safe { background-color: var(--royal-green); }

/* Card Content */
.product-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.6rem;
    font-family: var(--font-outfit);
}

.product-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.88rem; /* line-height 1.6 * 0.9 * 2 */
}

/* Card Price and Stock Counter */
.card-pricing-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.2rem;
}

.price-label-group {
    display: flex;
    flex-direction: column;
}

.price-small-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.price-tag {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--royal-gold);
}

.stock-control {
    display: flex;
    align-items: center;
    background: rgba(10, 8, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.2rem;
}

.stock-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.stock-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--royal-gold);
}

.stock-number {
    padding: 0 0.8rem;
    font-weight: 600;
    font-size: 1rem;
    min-width: 40px;
    text-align: center;
}

/* Card Action Area */
.card-actions {
    display: flex;
    gap: 0.8rem;
}

.card-actions .btn {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}

.btn-edit-action {
    background: rgba(229, 193, 88, 0.1);
    border: 1px solid var(--border-gold);
    color: var(--royal-gold);
}

.btn-edit-action:hover {
    background: rgba(229, 193, 88, 0.2);
    border-color: var(--royal-gold);
}

.btn-delete-action {
    background: rgba(200, 59, 80, 0.08);
    border: 1px solid rgba(200, 59, 80, 0.2);
    color: var(--royal-red-hover);
}

.btn-delete-action:hover {
    background: rgba(200, 59, 80, 0.2);
    border-color: var(--royal-red);
}

/* Spinner Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    gap: 1.5rem;
    color: var(--text-muted);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(212, 175, 55, 0.1);
    border-top-color: var(--royal-gold);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--bg-card);
    border: 1px dashed var(--border-gold);
    border-radius: 24px;
    max-width: 600px;
    margin: 0 auto;
    backdrop-filter: blur(10px);
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
}

/* Modal Styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 3, 10, 0.85);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

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

.modal-card {
    background: #141124;
    border: 1px solid var(--border-gold-hover);
    border-radius: 24px;
    width: 90%;
    max-width: 580px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8), 0 0 30px rgba(229, 193, 88, 0.1);
    overflow: hidden;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
    transform: translateY(0);
}

.modal-header {
    background: rgba(229, 193, 88, 0.05);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-family: var(--font-outfit);
    color: var(--royal-gold);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--royal-red-hover);
    transform: rotate(90deg);
}

.modal-card form {
    padding: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.col-span-2 {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group label .required {
    color: var(--royal-red-hover);
}

.form-group input, .form-group select, .form-group textarea {
    background: rgba(10, 8, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--royal-gold);
    box-shadow: 0 0 10px rgba(229, 193, 88, 0.15);
}

.form-group select option {
    background: #141124;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 2000;
}

.toast {
    background: #1a152d;
    border-left: 4px solid var(--royal-gold);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    color: #fff;
    min-width: 300px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transform: translateX(120%);
    animation: toastIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: var(--transition-smooth);
}

.toast.toast-success {
    border-left-color: var(--royal-green);
}

.toast.toast-error {
    border-left-color: var(--royal-red-hover);
}

.toast-message {
    font-size: 0.95rem;
    font-weight: 500;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

/* Keyframe Animations */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 8px 20px rgba(229, 193, 88, 0.3); }
    50% { box-shadow: 0 8px 30px rgba(229, 193, 88, 0.6); }
}

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

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes toastIn {
    to { transform: translateX(0); }
}

/* Responsive Breakpoints */
/* Header Right Layout */
.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

/* Auth Bar Styles */
.auth-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.welcome-text {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.welcome-text strong {
    color: var(--royal-gold);
    margin-left: 0.2rem;
}

.btn-logout {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: rgba(200, 59, 80, 0.1);
    border: 1px solid rgba(200, 59, 80, 0.3);
    color: var(--royal-red-hover);
}

.btn-logout:hover {
    background: var(--royal-red);
    color: white;
    box-shadow: 0 4px 12px rgba(200, 59, 80, 0.3);
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 1.2rem;
    }
    .auth-bar {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    .stats-overview {
        width: 100%;
        justify-content: space-between;
    }
    .stat-card {
        flex: 1;
    }
    .toolbar-section {
        flex-direction: column;
        align-items: stretch;
    }
    .search-box {
        width: 100%;
    }
    .filter-group {
        order: 3;
    }
    .btn-add {
        order: 2;
        width: 100%;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .col-span-2 {
        grid-column: span 1;
    }
}
