:root {
    --bg-dark: #020617;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.3);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --accent: #818cf8;
    --danger: #f43f5e;
    --success: #10b981;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1e1b4b, transparent),
                radial-gradient(circle at bottom left, #0f172a, transparent);
}

/* Header Styles */
.app-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--primary);
}

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

.logo-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
    width: 32px;
    height: 32px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(to right, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* View Container */
#view-container {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem 3rem;
}

.view {
    display: none;
    animation: fadeIn 0.5s ease-out forwards;
}

.view.active {
    display: block;
}

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

/* Menu View Styles */
.hero-text {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-text h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero-text p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    justify-content: center;
}

.category-card {
    position: relative;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.category-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 10px 40px -10px var(--primary-glow);
}

.card-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.category-card:hover .card-glow {
    opacity: 1;
}

.card-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.category-card:hover .card-icon {
    filter: drop-shadow(0 0 12px var(--primary));
}

.category-card h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.category-card p {
    color: var(--text-dim);
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-family: inherit;
    font-weight: 600;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    width: 18px;
    height: 18px;
}

#search-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem 0.75rem 3rem;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

#search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Forms Grid */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.form-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.form-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 20px -5px rgba(0,0,0,0.5);
}

.form-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.form-id {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.stock-status {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stock-label {
    color: var(--text-dim);
    font-size: 0.875rem;
}

.stock-value {
    font-weight: 700;
    font-size: 1.5rem;
}

.stock-value.low { color: var(--danger); }
.stock-value.ok { color: var(--success); }

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sale {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-sale:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-sale:active {
    transform: translateY(0);
}

.btn-sale:disabled {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

/* Footer */
.app-footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.875rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    max-width: 450px;
    width: 100%;
    display: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px var(--primary-glow);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content.active {
    display: block;
}

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

.modal-content h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.modal-content p {
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section-group {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dim);
}

.input-group input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 0.875rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

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

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

/* Edit Stock Button */
.btn-edit-stock {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit-stock:hover {
    color: var(--text-main);
    border-color: var(--text-dim);
    background: rgba(255, 255, 255, 0.1);
}

/* Sales History Styles */
.sales-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.sales-table th {
    text-align: left;
    padding: 1rem;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sales-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

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

.sales-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.sale-date {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.sale-form-id {
    font-weight: 800;
    color: var(--accent);
}

.sale-price {
    font-weight: 700;
    color: var(--success);
}

/* Responsive */
@media (max-width: 640px) {
    .hero-text h1 { font-size: 2.25rem; }
    .dashboard-header { flex-direction: column; align-items: stretch; }
    #category-title { order: -1; text-align: center; }
}
