/* ============================================================
   AgriMarket — Reusable UI Components
   ============================================================ */

/* ============================================================
   Navigation
   ============================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    z-index: 1000;
    transition: all var(--transition-base);
}

.navbar--transparent {
    background: transparent;
}

.navbar--solid {
    background: rgba(15, 42, 29, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
}

.navbar__logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--white);
    text-decoration: none;
}

.navbar__logo-icon {
    font-size: 1.8rem;
}

.navbar__logo-text span {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar__links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.navbar__link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    position: relative;
}

.navbar__link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-gold);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.navbar__link:hover {
    color: var(--white);
}

.navbar__link:hover::after {
    width: 100%;
}

.navbar__actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.navbar__cart {
    position: relative;
    color: var(--white);
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.navbar__cart:hover {
    transform: scale(1.1);
}

.navbar__cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: var(--accent);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Menu */
.navbar__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
}

.navbar__toggle span {
    width: 24px;
    height: 2px;
    background: var(--white);
    transition: all var(--transition-fast);
    border-radius: 2px;
}

@media (max-width: 768px) {
    .navbar__toggle {
        display: flex;
    }

    .navbar__links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--primary-darker);
        flex-direction: column;
        justify-content: center;
        gap: var(--space-xl);
        transition: right var(--transition-slow);
        padding: var(--space-2xl);
    }

    .navbar__links.active {
        right: 0;
    }

    .navbar__link {
        font-size: 1.1rem;
    }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

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

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

.btn--secondary {
    background: transparent;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.4);
}

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

.btn--outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn--gold {
    background: var(--gradient-gold);
    color: var(--primary-dark);
    font-weight: 700;
}

.btn--gold:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

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

.btn--danger:hover {
    background: #DC2626;
    transform: translateY(-2px);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}

.btn--ghost:hover {
    background: var(--surface);
    color: var(--primary);
}

.btn--sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn--lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn--block {
    width: 100%;
}

.btn--icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

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

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card--glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--white);
}

.card--flat {
    box-shadow: none;
    border: 1px solid var(--border);
}

.card--flat:hover {
    box-shadow: none;
    transform: none;
    border-color: var(--primary-light);
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    background: var(--white);
    color: var(--text-primary);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input--error {
    border-color: var(--error);
}

.form-input--error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-error {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: var(--space-xs);
}

.form-select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--white);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: all var(--transition-fast);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.1);
}

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

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================================
   Badges & Tags
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge--primary {
    background: rgba(45, 106, 79, 0.1);
    color: var(--primary);
}

.badge--success {
    background: var(--success-light);
    color: #065F46;
}

.badge--warning {
    background: var(--warning-light);
    color: #92400E;
}

.badge--error {
    background: var(--error-light);
    color: #991B1B;
}

.badge--info {
    background: var(--info-light);
    color: #1E40AF;
}

.badge--gold {
    background: rgba(212, 163, 115, 0.15);
    color: #92400E;
}

/* ============================================================
   Tables
   ============================================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    background: var(--surface);
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tr:hover td {
    background: rgba(45, 106, 79, 0.02);
}

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

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-md));
    right: var(--space-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 420px;
    animation: slideInRight 0.3s var(--transition-spring);
    border-left: 4px solid;
}

.toast--success { border-color: var(--success); }
.toast--error { border-color: var(--error); }
.toast--warning { border-color: var(--warning); }
.toast--info { border-color: var(--info); }

.toast__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast__content {
    flex: 1;
}

.toast__title {
    font-weight: 600;
    font-size: 0.9rem;
}

.toast__message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.toast__close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color var(--transition-fast);
}

.toast__close:hover {
    color: var(--text-primary);
}

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

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 42, 29, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.modal__title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal__close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 1.2rem;
    color: var(--text-muted);
}

.modal__close:hover {
    background: var(--surface);
    color: var(--text-primary);
}

/* ============================================================
   Loading States
   ============================================================ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner--sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner--lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(250, 253, 247, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    z-index: 10001;
}

.loading-overlay__text {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-alt) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

/* ============================================================
   Empty States
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
}

.empty-state__icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.empty-state__text {
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.avatar--sm { width: 32px; height: 32px; }
.avatar--lg { width: 56px; height: 56px; }
.avatar--xl { width: 80px; height: 80px; }

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-2xl);
}

.pagination__btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
    background: var(--white);
}

.pagination__btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination__btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ============================================================
   Stars Rating
   ============================================================ */
.stars {
    display: flex;
    gap: 2px;
}

.stars__star {
    color: var(--border);
    font-size: 1rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.stars__star.filled {
    color: var(--secondary-light);
}

.stars__star:hover {
    color: var(--secondary);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    background: var(--primary-darker);
    color: rgba(255, 255, 255, 0.7);
    padding: var(--space-4xl) 0 var(--space-xl);
}

.footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.footer__brand {
    max-width: 300px;
}

.footer__logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.footer__logo span {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer__desc {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

.footer__heading {
    color: var(--white);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--space-lg);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer__link {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    padding: 0.35rem 0;
    transition: all var(--transition-fast);
}

.footer__link:hover {
    color: var(--white);
    transform: translateX(4px);
}

.footer__bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.footer__socials {
    display: flex;
    gap: var(--space-md);
}

.footer__social {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.footer__social:hover {
    background: var(--primary-light);
    color: var(--white);
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer__bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}
