/* ===== AGRO Style ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green: #00923f;
    --green-light: #00b34d;
    --green-dark: #006b2e;
    --bg: #f4faf7;
    --card: #ffffff;
    --border: #d0e8d8;
    --text: #1a2e1a;
    --text-light: #4a7a5a;
    --danger: #d32f2f;
    --warning: #f9a825;
    --success: #00923f;
    --shadow: 0 2px 8px rgba(0,146,63,0.12);
}
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ===== Header ===== */
.header {
    background: var(--green-dark);
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-header {
    background: linear-gradient(135deg, #1a3a2a, #00923f);
}

.admin-header .nav a {
    background: rgba(255,255,255,0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    transition: background 0.2s;
}

.admin-header .nav a:hover {
    background: rgba(255,255,255,0.25);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1.4em;
    font-weight: 700;
    color: #fff;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.admin-header .logo-img {
    border: 2px solid rgba(255,255,255,0.3);
    width: 38px;
    height: 38px;
}

.header-stats {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: white;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 15px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav a:hover {
    background: rgba(255,255,255,0.15);
}

.cart-link {
    position: relative;
}

.cart-count {
    background: var(--warning);
    color: #333;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: super;
}

/* ===== Main ===== */
main {
    flex: 1;
    padding: 40px 0;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 40px 0 20px;
}

.hero h1 {
    margin-bottom: 8px;
}

.hero-search textarea {
    min-height: 80px;
}

.search-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--green, #00923f);
    color: var(--green, #00923f);
}

.btn-outline:hover {
    background: var(--green, #00923f);
    color: #fff;
}

.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.results-header h2 {
    margin: 0;
}

.results-header .btn-outline {
    margin-left: auto;
}

.hero h1 {
    font-size: 48px;
    color: var(--green-dark);
    margin-bottom: 12px;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.hero-desc {
    color: var(--text-light);
    margin-bottom: 30px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== Features ===== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 40px 0;
}

.feature-card {
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.feature-card h3 {
    margin-bottom: 8px;
    color: var(--green-dark);
}

.feature-card p {
    color: var(--text-light);
    font-size: 14px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }

.btn-secondary { background: #e8e8e8; color: var(--text); }
.btn-secondary:hover { background: #ddd; }

.btn-success { background: var(--success); color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b71c1c; }

.btn-lg { font-size: 16px; padding: 14px 28px; }
.btn-sm { font-size: 12px; padding: 6px 12px; }

/* ===== Search ===== */
.search-section {
    max-width: 900px;
    margin: 0 auto;
}

.search-section h1 {
    margin-bottom: 8px;
}

.help-text {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 14px;
}

.search-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero-search {
    max-width: 700px;
    margin: 20px auto 0;
}

.hero-search textarea {
    font-size: 16px;
    font-family: inherit;
    padding: 16px 20px;
}

.search-box textarea {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.search-box textarea:focus {
    border-color: var(--green);
}

/* ===== Results ===== */
.search-results {
    margin-top: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.results-count {
    color: var(--text-light);
    font-size: 14px;
}

.result-group {
    margin-bottom: 24px;
}

.result-group-title {
    background: var(--green-dark);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.result-item:hover {
    border-color: var(--green-light);
    box-shadow: var(--shadow);
}

.item-info {
    flex: 1;
}

.item-brand {
    font-weight: 700;
    color: var(--green-dark);
    font-size: 13px;
}

.item-number {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 600;
}

.item-name {
    font-size: 13px;
    color: var(--text-light);
}

.item-supplier {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.item-pricing {
    text-align: right;
    min-width: 120px;
}

.item-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--green);
}

.item-price-na {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
}

.item-pcs {
    font-size: 12px;
    color: var(--text-light);
}

.add-to-cart-btn {
    background: var(--green);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s;
    white-space: nowrap;
}

.add-to-cart-btn:hover {
    background: var(--green-dark);
}

.add-to-cart-btn.in-cart {
    background: var(--warning);
    color: #333;
}

/* ===== Cart ===== */
.cart-section {
    max-width: 800px;
    margin: 0 auto;
}

.cart-empty {
    text-align: center;
    padding: 60px 0;
}

.cart-empty p {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.cart-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cart-item .item-info {
    flex: 1;
}

.cart-item .item-price {
    font-size: 16px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-qty input {
    width: 50px;
    padding: 4px 8px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.cart-summary {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
    text-align: right;
}

.cart-total {
    font-size: 18px;
}

.cart-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* ===== Order Form ===== */
.order-form-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.order-form-section h2 {
    margin-bottom: 16px;
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 400px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
}

.form-group input:focus {
    border-color: var(--green);
}

.order-result {
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-weight: 600;
}

.order-result.success {
    background: #e8f5e9;
    color: var(--success);
    border: 1px solid #c8e6c9;
}

.order-result.error {
    background: #ffebee;
    color: var(--danger);
    border: 1px solid #ffcdd2;
}

/* ===== Share ===== */
.share-result {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.share-result input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-info {
    background: #e3f2fd;
    color: #0d47a1;
    border: 1px solid #bbdefb;
}

.alert-error {
    background: #ffebee;
    color: var(--danger);
    border: 1px solid #ffcdd2;
}

/* ===== Admin ===== */
.admin-section {
    max-width: 1000px;
    margin: 0 auto;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 4px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--green);
    color: white;
}

.tab-content {
    display: none;
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-table th {
    background: var(--green-dark);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.admin-table tr:hover td {
    background: #f5faf5;
}

.admin-table .success { color: var(--success); font-weight: 600; }
.admin-table .error { color: var(--danger); font-weight: 600; }

/* ===== Upload Area (drag & drop) ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: var(--card);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--green);
    background: #f0faf0;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-placeholder p {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 13px !important;
    color: var(--text-light) !important;
}

.upload-progress {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-progress-bar {
    height: 8px;
    background: var(--green);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s;
    flex: 1;
}

.upload-progress-text {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

/* ===== Files list ===== */
.files-list {
    margin-top: 16px;
}

.files-empty {
    text-align: center;
    padding: 40px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.files-empty p {
    color: var(--text-light);
    font-size: 15px;
}

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ===== Admin result ===== */
.admin-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.5;
}

.admin-result.success {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: var(--success);
}

.admin-result.error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: var(--danger);
}

.admin-result ul {
    margin-top: 8px;
    padding-left: 20px;
}

.admin-result li {
    margin-bottom: 4px;
}

.admin-result li.success { color: var(--success); }
.admin-result li.error { color: var(--danger); }

.loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: var(--text-light);
}

.loading-status {
    color: var(--text-light);
}

/* ===== Search loading/error ===== */
.search-loading {
    text-align: center;
    padding: 30px;
    font-size: 18px;
    color: var(--text-light);
}

.search-error {
    background: #ffebee;
    color: var(--danger);
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    border: 1px solid #ffcdd2;
}

/* ===== Footer ===== */
.footer {
    background: var(--green-dark);
    color: rgba(255,255,255,0.7);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero h1 { font-size: 32px; }
    .result-item { flex-direction: column; text-align: center; }
    .item-pricing { text-align: center; }
    .cart-item { flex-direction: column; }
    .cart-actions { flex-direction: column; }
}
