/* ============ RESET & VARIABLES ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #e67e22;
    --primary-dark: #d35400;
    --primary-light: #f39c12;
    --gold: #f1c40f;
    --bg: #f5f6fa;
    --white: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --danger: #e74c3c;
    --success: #27ae60;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.25s ease;
    --whatsapp: #25D366;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ============ AUTH ============ */
.auth-wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.auth-wrap::before {
    content: ''; position: absolute;
    top: -30%; left: -20%;
    width: 70%; height: 70%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.auth-box {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 36px 28px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.3);
}
.auth-icon {
    width: 64px; height: 64px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px; color: var(--white);
}
.auth-title { font-size: 22px; color: var(--text); margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--text-light); margin-bottom: 20px; }
.auth-error { color: var(--danger); font-size: 13px; margin-bottom: 10px; display: none; }
.inp-grp {
    display: flex; align-items: center;
    background: var(--bg); border-radius: var(--radius-sm);
    padding: 12px 14px; margin-bottom: 12px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.inp-grp:focus-within { border-color: var(--primary); }
.inp-grp i { color: var(--text-light); font-size: 16px; width: 20px; text-align: center; }
.inp-grp input, .inp-grp select {
    flex: 1; border: none; background: none;
    font-size: 15px; color: var(--text);
    outline: none; padding: 0 10px; font-family: inherit;
}
.btn-auth {
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white); border: none;
    border-radius: var(--radius-sm); font-size: 15px;
    font-weight: 700; cursor: pointer; margin-top: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(230, 126, 34, 0.25);
    letter-spacing: 0.3px;
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(230, 126, 34, 0.35); }
.btn-auth:active { transform: scale(0.97); }
.auth-alt { text-align: center; font-size: 13px; color: var(--text-light); margin-top: 16px; }
.auth-alt a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ============ HEADER ============ */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white); position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; }
.header-left strong { font-size: 16px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.btn-icon {
    background: rgba(255,255,255,0.15);
    border: none; color: var(--white); width: 36px; height: 36px;
    border-radius: 50%; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.25); }

/* ============ SEARCH BAR ============ */
.search-bar {
    background: var(--white); padding: 10px 16px;
    display: flex; gap: 8px; box-shadow: var(--shadow);
    position: sticky; top: 52px; z-index: 99;
}
.search-bar input {
    flex: 1; border: 2px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: 14px; outline: none;
    transition: var(--transition);
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar select {
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px; font-size: 13px; outline: none; background: var(--white);
    cursor: pointer;
}

/* ============ TAB CONTENT ============ */
.main-content { padding: 16px 16px 80px; position: relative; }

/* ============ ITEMS GRID ============ */
.items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.item-card {
    background: var(--white); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    cursor: pointer; transition: var(--transition);
}
.item-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.item-card-img {
    width: 100%; height: 150px;
    object-fit: cover; display: block;
    background: var(--border);
}
.item-card-img-placeholder {
    width: 100%; height: 150px;
    background: linear-gradient(135deg, var(--border), #eee);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; color: var(--text-light);
}
.item-card-body { padding: 10px 12px 12px; }
.item-card-title {
    font-size: 14px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
}
.item-card-price {
    font-size: 16px; font-weight: 700; color: var(--primary);
}
.item-card-meta {
    font-size: 11px; color: var(--text-light); margin-top: 4px;
    display: flex; align-items: center; gap: 8px;
}
.item-card-meta span { display: flex; align-items: center; gap: 3px; }
.item-card-sold {
    position: absolute; top: 8px; right: 8px;
    background: var(--danger); color: var(--white);
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
}
.item-card { position: relative; }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-light);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ============ POST FORM ============ */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text); margin-bottom: 5px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 14px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; outline: none; transition: var(--transition);
    font-family: inherit; background: var(--white);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; }
.img-preview { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.img-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }

/* ============ MY ADS ============ */
.my-ad-card {
    display: flex; background: var(--white);
    border-radius: var(--radius-sm); margin-bottom: 10px;
    overflow: hidden; box-shadow: var(--shadow);
}
.my-ad-img {
    width: 100px; height: 100px; object-fit: cover;
    flex-shrink: 0; background: var(--border);
}
.my-ad-body { padding: 10px 14px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.my-ad-body strong { font-size: 14px; }
.my-ad-body .price { color: var(--primary); font-weight: 700; font-size: 15px; }
.my-ad-body .status { font-size: 11px; margin-top: 4px; }
.my-ad-body .status.active { color: var(--success); }
.my-ad-body .status.sold { color: var(--danger); }
.my-ad-actions { display: flex; align-items: center; padding-right: 10px; gap: 6px; }
.btn-sm {
    padding: 6px 12px; border: none; border-radius: 6px; font-size: 12px;
    cursor: pointer; font-weight: 600; transition: var(--transition);
}
.btn-sm:hover { opacity: 0.85; }
.btn-sm.danger { background: var(--danger); color: var(--white); }

/* ============ PROFILE ============ */
.profile-card {
    background: var(--white); border-radius: var(--radius);
    padding: 24px; text-align: center; box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--primary); display: flex;
    align-items: center; justify-content: center;
    margin: 0 auto 12px;
}
.profile-avatar span { font-size: 32px; color: var(--white); font-weight: 700; }
.profile-info strong { display: block; font-size: 18px; margin-bottom: 4px; }
.profile-info small { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 2px; }

/* ============ MENU LIST ============ */
.menu-list { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.menu-item {
    display: flex; align-items: center; width: 100%; padding: 16px;
    border: none; background: none; cursor: pointer; font-size: 14px;
    color: var(--text); border-bottom: 1px solid var(--border); text-align: left;
}
.menu-item:last-child { border-bottom: none; }
.menu-item i:first-child { width: 30px; font-size: 18px; color: var(--primary); }
.menu-item span { flex: 1; }
.menu-item i:last-child { color: var(--text-light); font-size: 12px; }

/* ============ MODAL ============ */
.modal { display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 16px; overflow-y: auto;
}
.modal.active { display: flex; }
.modal-content {
    background: white; border-radius: var(--radius);
    max-width: 500px; width: 100%; max-height: 90vh;
    overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn { 0% { opacity: 0; transform: translateY(20px) scale(0.95); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; color: var(--text); }
.modal-close { background: none; border: none; font-size: 26px; color: var(--text-light); cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; max-height: calc(90vh - 60px); }
.modal-images { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 8px; }
.modal-images img {
    width: 100%; max-height: 250px; object-fit: cover;
    border-radius: var(--radius-sm); flex-shrink: 0;
}
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.modal-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.modal-condition {
    font-size: 11px; padding: 3px 10px; border-radius: 20px;
    background: var(--bg); color: var(--text-light); font-weight: 600;
}
.modal-location, .modal-date { font-size: 13px; color: var(--text-light); }
.modal-location i { margin-right: 3px; }
.modal-desc { font-size: 14px; color: var(--text); line-height: 1.6; margin-bottom: 14px; }
.modal-seller {
    background: var(--bg); padding: 12px 14px;
    border-radius: var(--radius-sm); margin-bottom: 16px;
}
.modal-seller strong { font-size: 13px; display: block; margin-bottom: 4px; }
.modal-seller span { font-size: 14px; display: block; margin-bottom: 8px; }
.btn-whatsapp {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--whatsapp); color: var(--white);
    padding: 10px 18px; border-radius: var(--radius-sm);
    text-decoration: none; font-weight: 600; font-size: 13px;
    transition: var(--transition);
}
.btn-whatsapp:hover { opacity: 0.9; }

/* ============ COMMENTS ============ */
.comments-section h4 { font-size: 14px; margin-bottom: 10px; color: var(--text); }
.comment-form { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-form input {
    flex: 1; padding: 10px 14px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; outline: none;
    transition: var(--transition);
}
.comment-form input:focus { border-color: var(--primary); }
.comment-form button {
    background: var(--primary); color: var(--white); border: none;
    width: 42px; height: 42px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 16px; transition: var(--transition);
}
.comment-form button:hover { opacity: 0.85; }
.comment-item {
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.comment-item:last-child { border-bottom: none; }
.comment-item strong { color: var(--primary); }
.comment-item small { color: var(--text-light); font-size: 11px; margin-left: 6px; }
.comment-item p { margin-top: 2px; }

/* ============ BOTTOM NAV ============ */
.tab-nav {
    display: flex;
    background: var(--white);
    box-shadow: 0 -1px 8px rgba(0,0,0,0.05);
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 50;
    border-top: 1px solid var(--border);
}
.tab-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 4px 6px; border: none; background: none;
    cursor: pointer; color: var(--text-light); font-size: 10px;
    transition: var(--transition); position: relative;
}
.tab-btn i { font-size: 20px; margin-bottom: 2px; transition: var(--transition); }
.tab-btn span { font-size: 9px; font-weight: 500; }
.tab-btn.active { color: var(--primary); }
.tab-btn.active i { transform: translateY(-2px); }
.tab-panel { display: none; animation: panelIn 0.3s ease; }
.tab-panel.active { display: block; }
@keyframes panelIn { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }

/* ============ RESPONSIVE ============ */
@media (max-width: 360px) {
    .items-grid { grid-template-columns: 1fr; }
    .main-content { padding: 12px 12px 76px; }
}
@media (min-width: 600px) {
    .items-grid { grid-template-columns: 1fr 1fr 1fr; }
}
