/* ===== IDENTIDADE VISUAL — AgriConnect Angola =====
   Paleta extraída do logotipo real: verde-floresta + dourado da colheita
*/
:root {
    --forest: #1B4D2E;
    --forest-deep: #0F3320;
    --leaf: #4CA857;
    --leaf-light: #E8F5E9;
    --gold: #F0A93A;
    --gold-deep: #D98A1F;
    --cream: #FBF8F2;
    --charcoal: #23281F;
    --earth: #8B5E34;
}

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

body {
    font-family: 'Work Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--cream);
    color: var(--charcoal);
    line-height: 1.6;
}

h1, h2, h3, .logo, .hero h1 {
    font-family: 'Sora', 'Segoe UI', sans-serif;
}

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

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(120deg, var(--forest-deep), var(--forest));
    color: white;
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(15, 51, 32, 0.25);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.2px;
}

.logo-icon {
    font-size: 26px;
}

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

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.25s, transform 0.15s;
    font-weight: 500;
    font-size: 15px;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.14);
}

.nav-links a.active {
    background: var(--gold);
    color: var(--forest-deep);
    font-weight: 700;
}

.btn-logout {
    background: rgba(255, 82, 82, 0.18) !important;
    border: 1px solid rgba(255, 82, 82, 0.35);
}

.btn-logout:hover {
    background: rgba(255, 82, 82, 0.35) !important;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #e53935;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--forest);
    line-height: 1;
}

/* ===== DESTAQUE DE ITEM NOVO (pedidos, transporte, conversas) ===== */
.item-new {
    background: rgba(240, 169, 58, 0.14) !important;
    border-left: 4px solid var(--gold) !important;
    position: relative;
}

.item-new-tag {
    display: inline-block;
    background: var(--gold);
    color: var(--forest-deep);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    margin-left: 8px;
    vertical-align: middle;
}

.item-dismiss-btn {
    background: none;
    border: none;
    color: #bbb;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}

.item-dismiss-btn:hover {
    color: #e53935;
    background: rgba(229, 57, 53, 0.1);
}

/* ===== BOTÕES ===== */
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-deep));
    color: var(--forest-deep);
    padding: 13px 32px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.25s;
    box-shadow: 0 4px 14px rgba(217, 138, 31, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(217, 138, 31, 0.45);
}

.btn-full {
    width: 100%;
}

/* ===== AUTH (Login/Registro) ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 20% 20%, rgba(240, 169, 58, 0.15), transparent 45%), linear-gradient(135deg, var(--forest-deep), var(--forest));
    padding: 20px;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 18px;
    box-shadow: 0 16px 45px rgba(15, 51, 32, 0.35);
    max-width: 420px;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-icon {
    font-size: 50px;
    margin-bottom: 10px;
}

.auth-header h1 {
    color: var(--forest);
    font-size: 26px;
    font-weight: 700;
}

.auth-header p {
    color: #666;
    font-size: 14px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.auth-link a {
    color: #2E7D32;
    font-weight: bold;
    text-decoration: none;
}

/* ===== FORMULÁRIOS ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2E7D32;
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 72px 20px 56px;
    background:
        radial-gradient(circle at 15% 20%, rgba(240, 169, 58, 0.18), transparent 45%),
        linear-gradient(135deg, var(--forest-deep), var(--forest) 60%, var(--leaf));
    color: white;
    border-radius: 20px;
    margin: 20px 0 40px;
    position: relative;
    overflow: hidden;
}

.hero h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 19px;
    opacity: 0.92;
    margin-bottom: 8px;
}

.hero .btn-primary {
    margin-top: 4px;
}

.hero-divider {
    width: 64px;
    height: 4px;
    background: var(--gold);
    border-radius: 2px;
    margin: 18px auto 26px;
}

/* ===== CATEGORIAS ===== */
.categories {
    margin: 30px 0;
}

.categories h2 {
    margin-bottom: 16px;
    font-size: 22px;
    position: relative;
    padding-bottom: 10px;
}

.categories h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 3px;
    background: var(--gold);
    border-radius: 2px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.category-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--gold);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(27, 77, 46, 0.18);
}

/* ===== PRODUTOS ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

.search-box input {
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    min-width: 250px;
}

.search-box input:focus {
    border-color: #2E7D32;
    outline: none;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.filter-btn:hover {
    border-color: var(--forest);
}

.filter-btn.active {
    background: var(--forest);
    color: white;
    border-color: var(--forest);
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.product-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(27, 77, 46, 0.08);
    border: 1px solid rgba(27, 77, 46, 0.06);
    transition: transform 0.25s, box-shadow 0.25s;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(27, 77, 46, 0.18);
}

.product-image {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

/* ===== FUNDO DE PRODUTO SEM FOTO — gradiente por categoria ===== */
.product-icon-bg {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 58px;
    position: relative;
    overflow: hidden;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

.product-icon-bg span {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.22));
}

.product-icon-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.4), transparent 55%);
    pointer-events: none;
}

.product-icon-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 90%, rgba(0, 0, 0, 0.12), transparent 60%);
    pointer-events: none;
}

.cat-cereals {
    background: linear-gradient(135deg, #F3D98B, #C99A3E);
}

.cat-vegetables {
    background: linear-gradient(135deg, #9BE39C, #3F8F4C);
}

.cat-fruits {
    background: linear-gradient(135deg, #FFB199, #D9503C);
}

.cat-tubers {
    background: linear-gradient(135deg, #DAB48A, #9C6B3E);
}

.cat-legumes {
    background: linear-gradient(135deg, #C7D394, #7C9450);
}

.cat-seeds {
    background: linear-gradient(135deg, #A9E0C8, #3E9E7C);
}

.cat-fertilizers {
    background: linear-gradient(135deg, #9BDCE6, #237A8F);
}

.cat-machinery {
    background: linear-gradient(135deg, #B7C2CA, #4E6672);
}

.cat-default {
    background: linear-gradient(135deg, #d8e8d8, #a8c8a8);
}

.product-info {
    padding: 16px;
}

.product-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.product-price {
    color: var(--forest);
    font-weight: 800;
    font-size: 19px;
}

.product-farmer {
    color: #666;
    font-size: 13px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #888;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

/* ===== FORMULÁRIO DE PUBLICAÇÃO ===== */
.form-container {
    max-width: 700px;
    margin: 30px auto;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.form-container h1 {
    margin-bottom: 24px;
    text-align: center;
}

/* ===== PERFIL ===== */
.profile-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin: 30px 0;
}

.profile-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    align-self: start;
}

.profile-avatar {
    font-size: 60px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-card h2 {
    font-size: 22px;
    margin-bottom: 4px;
}

.profile-type {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.profile-info {
    text-align: left;
}

.info-item {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.info-label {
    font-weight: 500;
    display: block;
    font-size: 13px;
    color: #888;
}

.my-products h3 {
    margin-bottom: 16px;
}

/* ===== FOOTER ===== */
footer {
    background: var(--forest-deep);
    color: rgba(255, 255, 255, 0.6);
    padding: 22px 0;
    margin-top: 40px;
    text-align: center;
    font-size: 14px;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 26px;
    }

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

    .profile-container {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 12px;
    }

    .search-box input {
        width: 100%;
        min-width: auto;
    }

    .filter-bar {
        justify-content: center;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* ============================================
   PRODUTO DETALHES
   ============================================ */
.product-detail-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.product-detail-image {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    object-fit: cover;
    background: #e8f5e9;
}

.product-detail-info h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.product-detail-price {
    font-size: 32px;
    color: #2E7D32;
    font-weight: bold;
    margin: 15px 0;
}

.product-detail-meta {
    color: #666;
    margin: 10px 0;
}

.product-detail-description {
    margin: 20px 0;
    color: #555;
    line-height: 1.6;
}

.product-detail-farmer {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.product-detail-farmer h3 {
    margin-bottom: 5px;
}

/* ============================================
   FORMULÁRIO DE PEDIDO
   ============================================ */
.order-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.order-form .form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.order-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

.order-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 14px;
}

.order-form input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.order-form input:focus {
    border-color: #2E7D32;
    outline: none;
}

.btn-order {
    background-color: #FF6F00;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    min-width: 150px;
}

.btn-order:hover {
    background-color: #E65100;
}

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

/* ============================================
   MEUS PEDIDOS
   ============================================ */
.orders-container {
    margin: 30px 0;
}

.order-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #FF6F00;
}

.order-card .order-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.order-status.pending {
    background: #FFF3E0;
    color: #E65100;
}

.order-status.confirmed {
    background: #E3F2FD;
    color: #0D47A1;
}

.order-status.shipped {
    background: #E8F5E9;
    color: #1B5E20;
}

.order-status.delivered {
    background: #F1F8E9;
    color: #33691E;
}

.order-status.cancelled {
    background: #FFEBEE;
    color: #C62828;
}

.order-card .order-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.order-card .btn-sm {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}

.btn-sm.confirm {
    background: #2E7D32;
    color: white;
}

.btn-sm.confirm:hover {
    background: #1B5E20;
}

.btn-sm.cancel {
    background: #d32f2f;
    color: white;
}

.btn-sm.cancel:hover {
    background: #b71c1c;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
    }

    .product-detail-image {
        height: 250px;
    }

    .order-form .form-row {
        flex-direction: column;
    }

    .order-form .form-group {
        width: 100%;
    }

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

/* ============================================
   CHAT
   ============================================ */
.chat-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    margin: 20px 0;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    min-height: 500px;
}

.chat-list {
    background: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #eee;
    overflow-y: auto;
    max-height: 500px;
}

.chat-list h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.chat-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.chat-item:hover {
    background: #e8f5e9;
}

.chat-item.active {
    background: #e8f5e9;
    border-left-color: #2E7D32;
}

.chat-item .chat-name {
    font-weight: bold;
    font-size: 14px;
}

.chat-item .chat-last {
    font-size: 12px;
    color: #888;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item .chat-time {
    font-size: 11px;
    color: #aaa;
}

.chat-window {
    display: flex;
    flex-direction: column;
    height: 500px;
}

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.message {
    margin-bottom: 12px;
    max-width: 70%;
    clear: both;
}

.message.sent {
    float: right;
}

.message.received {
    float: left;
}

.message .message-bubble {
    padding: 10px 16px;
    border-radius: 12px;
    display: inline-block;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: #2E7D32;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message .message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    display: block;
}

.chat-input {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.chat-input input:focus {
    border-color: #2E7D32;
    outline: none;
}

.chat-input button {
    padding: 10px 24px;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.chat-input button:hover {
    background: #1B5E20;
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
    }

    .chat-list {
        border-right: none;
        border-bottom: 1px solid #eee;
        max-height: 200px;
    }

    .chat-window {
        height: 400px;
    }
}

/* ============================================
   TRANSPORTE
   ============================================ */
.transport-container {
    margin: 20px 0;
}

.transport-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.transport-section h2 {
    margin-bottom: 16px;
    font-size: 20px;
}

.transport-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.transport-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid #2E7D32;
}

.transport-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.transport-card .transport-meta {
    font-size: 13px;
    color: #666;
    margin: 4px 0;
}

.transport-card .transport-action {
    margin-top: 12px;
}

.transport-card .btn-transport {
    padding: 6px 16px;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.transport-card .btn-transport:hover {
    background: #1B5E20;
}

.transport-card .btn-transport.chat {
    background: #1976D2;
}

.transport-card .btn-transport.chat:hover {
    background: #0D47A1;
}

@media (max-width: 768px) {
    .transport-grid {
        grid-template-columns: 1fr;
    }
}