/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Design System */
:root {
    /* Colors */
    --primary: hsl(262, 83%, 58%);
    --primary-dark: hsl(262, 83%, 48%);
    --primary-light: hsl(262, 83%, 68%);
    --secondary: hsl(195, 100%, 50%);
    --success: hsl(142, 71%, 45%);
    --warning: hsl(38, 92%, 50%);
    --error: hsl(0, 84%, 60%);
    --dark: hsl(230, 17%, 14%);
    --dark-light: hsl(230, 17%, 24%);
    --gray: hsl(228, 12%, 44%);
    --gray-light: hsl(228, 12%, 94%);
    --white: hsl(0, 0%, 100%);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, hsl(262, 83%, 58%) 0%, hsl(195, 100%, 50%) 100%);
    --gradient-dark: linear-gradient(135deg, hsl(230, 17%, 14%) 0%, hsl(230, 17%, 24%) 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(138, 43, 226, 0.3);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gradient-dark);
    color: var(--white);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 191, 255, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundPulse 10s ease-in-out infinite;
}

@keyframes backgroundPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* Container */
.container {
    max-width: 1200px;
    min-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: fadeInDown 0.6s ease;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 0 30px rgba(138, 43, 226, 0.3);
}

.header p {
    color: var(--gray-light);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Card */
.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-light);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

label .required {
    color: var(--error);
    font-size: 1.2rem;
}

/* Input Styles */
input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--white);
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-normal);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(138, 43, 226, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

select option {
    background: var(--dark);
    color: var(--white);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Read-only inputs */
input:read-only {
    background: rgba(255, 255, 255, 0.03);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Stock Info */
.stock-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid rgba(0, 191, 255, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
    animation: fadeIn 0.3s ease;
}

.stock-info.low-stock {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.3);
}

.stock-info.out-of-stock {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
}

/* Price Info */
.price-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-md);
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.price-item.total {
    grid-column: 1 / -1;
    background: var(--gradient-primary);
    font-size: 1.25rem;
    font-weight: 700;
    padding: var(--spacing-md);
}

.price-label {
    color: var(--gray-light);
    font-weight: 500;
}

.price-value {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.btn {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

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

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

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Messages */
.message {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideInDown 0.4s ease;
    font-weight: 500;
}

.message.success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

.message.error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--error);
    color: var(--error);
}

.message.warning {
    background: rgba(255, 152, 0, 0.2);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.message.info {
    background: rgba(0, 191, 255, 0.2);
    border: 1px solid var(--secondary);
    color: var(--secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design disabled to force desktop mode */
/* 
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .card {
        padding: var(--spacing-md);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .price-info {
        grid-template-columns: 1fr;
    }
}
*/

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-xs);
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-3 {
    margin-top: var(--spacing-md);
}

.mt-4 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-xs);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-3 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

/* Product Row Styles */
.product-row {
    margin-bottom: var(--spacing-md);
}

/* Product Table Styles */
.product-table-container {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    overflow: visible;
    /* Changed from hidden to allow suggestions dropdown to show */
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    background: var(--white);
}

.product-table-header {
    display: grid;
    grid-template-columns: 3fr 0.8fr 0.8fr 1.5fr 1.5fr auto;
    gap: 1px;
    background: var(--gradient-primary);
    color: var(--white);
    font-weight: 600;
    text-align: center;
    padding: 0;
    border-bottom: 2px solid var(--primary-dark);
}

.header-cell {
    padding: 12px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.product-row {
    display: grid;
    grid-template-columns: 3fr 0.8fr 0.8fr 1.5fr 1.5fr auto;
    gap: 1px;
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-light);
    align-items: stretch;
}

.product-row:nth-child(even) {
    background-color: #f8fafc;
}

.product-row:hover {
    background-color: #f1f5f9;
}

.cell {
    padding: 4px;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--gray-light);
}

.cell:last-child {
    border-right: none;
}

/* Input overrides for table */
.product-row .form-group {
    margin: 0;
    width: 100%;
}

.product-row input,
.product-row select {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px;
    height: 100%;
    margin: 0;
    background: transparent;
    color: var(--dark);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.product-row input:focus,
.product-row select:focus {
    border: 1px solid var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.1);
    z-index: 1;
}

.readonly-input {
    background-color: rgba(0, 0, 0, 0.02);
    text-align: right;
    width: 100%;
    border: none;
    padding: 8px;
    color: var(--dark);
    font-weight: 600;
    font-family: 'Consolas', monospace;
}

/* Search Autocomplete Styles */
.search-container {
    position: relative;
    width: 100%;
}

.produk-search {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px;
    font-size: 0.9rem;
    color: var(--dark);
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--primary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-light);
    font-size: 0.85rem;
    transition: background 0.1s;
    color: #000000;
    /* Black text as requested */
    font-weight: 500;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f1f5f9;
    color: #000000;
    /* Keep black on hover */
    font-weight: 600;
}

.suggestion-item .item-code {
    font-size: 0.75rem;
    color: var(--gray);
    margin-right: 5px;
}

.btn-remove-product {
    width: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

/* Add Product Button */
.btn-add-product {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: rgba(138, 43, 226, 0.15);
    border: 2px dashed rgba(138, 43, 226, 0.4);
    border-radius: var(--radius-sm);
    color: var(--primary-light);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-top: var(--spacing-sm);
}

.btn-add-product:hover {
    background: rgba(138, 43, 226, 0.25);
    border-color: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

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

/* Remove Product Button */
.btn-remove-product {
    padding: 0.875rem 1rem;
    background: rgba(244, 67, 54, 0.15);
    border: 2px solid rgba(244, 67, 54, 0.3);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-normal);
    height: auto;
    width: 100%;
    margin-top: var(--spacing-sm);
}

.btn-remove-product:hover {
    background: rgba(244, 67, 54, 0.25);
    border-color: var(--error);
    transform: scale(1.05);
}

.btn-remove-product:active {
    transform: scale(0.95);
}

/* Responsive Product Grid disabled */
/*
@media (max-width: 768px) {
    .product-row-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .btn-remove-product {
        width: 100%;
        min-width: unset;
    }
}
*/