/* --- BASE & HEADER --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #fdfdfd; min-height: 100vh; display: flex; flex-direction: column; }
.body-center { align-items: center; justify-content: center; height: 100vh; }

header { background: #fff; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 1000; padding: 0 20px; height: 70px; display: flex; align-items: center; }
.header-content { display: flex; align-items: center; width: 100%; justify-content: space-between; }
.header-left { display: flex; align-items: center; }
header img { height: 30px; width: auto; display: block; }
.brand-title { font-weight: 900; text-transform: uppercase; font-size: 10px; letter-spacing: 1px; margin-left: 12px; padding-left: 12px; border-left: 2px solid #eee; height: 30px; display: flex; align-items: center; line-height: 1; }

.header-nav { display: flex; align-items: center; gap: 10px; }
.welcome-text { font-size: 12px; color: #888; margin-right: 8px; }
.welcome-text strong { color: #000; }
.nav-icon { text-decoration: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: #f8f8f8; border-radius: 50%; color: #000; font-size: 16px; transition: 0.2s; flex-shrink: 0; }
.nav-icon:hover { background: #000; color: #fff; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; margin-right: 5px; }
.user-avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; margin-right: 5px; }

/* --- SECCIÓN DE CARGA (FORMULARIO) --- */
.upload-section { padding: 30px 0; background: #fff; border-bottom: 1px solid #eee; }
.container-small { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; }
.form-columns { display: flex; gap: 25px; }
.column-left { flex: 1.5; }
.column-right { flex: 1; }

/* --- MAIN CONTENT (Search + Gallery) --- */
.main-content { padding: 30px 0; background: #fdfdfd; }
.main-container { max-width: 1600px; margin: 0 auto; padding: 0 20px; width: 100%; }
.search-bar-full { margin-bottom: 15px; position: relative; }
#search-suggestions { position: absolute !important; top: 100% !important; left: 0 !important; right: 0 !important; z-index: 1000 !important; margin-top: 5px !important; background: #fff !important; border: 1px solid #eee !important; border-radius: 8px !important; box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; max-height: 200px !important; overflow-y: auto !important; }
.search-input-full { width: 100%; padding: 14px 20px; border: 1px solid #eee; border-radius: 12px; background: #fff; font-size: 14px; outline: none; position: relative; z-index: 101; }
.search-input-full:focus { border-color: #000; }

/* --- TAGS ROW --- */
.tags-row { display: flex; gap: 8px; flex-wrap: nowrap; overflow: hidden; margin-bottom: 25px; }
.filter-pill { background: #fff; border: 1px solid #eee; padding: 8px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.filter-pill:hover { background: #000; color: #fff; border-color: #000; }
.filter-pill.active { background: #000; color: #fff; border-color: #000; }
.tag-count { background: rgba(0,0,0,0.1); padding: 2px 6px; border-radius: 10px; font-size: 9px; font-weight: 700; }
.filter-pill.active .tag-count { background: rgba(255,255,255,0.2); }

/* --- GALERÍA --- */
.gallery-section { width: 100%; }
.gallery { column-count: 5; column-gap: 15px; width: 100%; }
.gallery-card { break-inside: avoid; background: #fff; border: 1px solid #eee; margin-bottom: 15px; border-radius: 12px; position: relative; overflow: hidden; }
.gallery-card img { width: 100%; display: block; cursor: pointer; }
.tags-preview { padding: 10px; font-size: 9px; color: #bbb; text-transform: uppercase; }

textarea { width: 100%; height: 280px; padding: 20px; border: 1px solid #ddd; border-radius: 12px; resize: vertical; font-family: monospace; font-size: 14px; outline: none; min-height: 150px; max-height: 500px; }
.prompt-tools { margin-top: 12px; }
.template-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; }
.tool-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #999; }
.tpl-btn { background: #f5f5f5; border: 1px solid #eee; padding: 5px 10px; border-radius: 6px; font-size: 10px; cursor: pointer; font-family: monospace; transition: 0.2s; }
.tpl-btn:hover { background: #000; color: #fff; border-color: #000; }
.notes-input { height: 60px !important; resize: none !important; background: #f9f9f9 !important; border: 1px solid #eee !important; border-radius: 8px !important; font-family: 'Inter', sans-serif !important; font-size: 13px !important; padding: 12px !important; }
.input-field, .search-input { width: 100%; padding: 14px; border: 1px solid #eee; border-radius: 8px; background: #f9f9f9; margin-bottom: 10px; font-size: 14px; outline: none; }
label { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; margin-bottom: 8px; color: #777; }

/* Sugerencias de Tags */
.tag-container { margin: 5px 0 15px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.tag-pill { background: #eee; padding: 5px 12px; border-radius: 20px; font-size: 10px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.tag-pill:hover { background: #000; color: #fff; }

.tags-input-wrapper { position: relative; }
.tag-suggestions { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #eee; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; max-height: 200px; overflow-y: auto; }
.tag-suggestions.active { display: block; }
.tag-suggestion { padding: 10px 14px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f5f5f5; }
.tag-suggestion:last-child { border-bottom: none; }
.tag-suggestion:hover { background: #f5f5f5; }
.tag-suggestion span { color: #888; font-size: 11px; }

.modal-tag-pill { background: #e0e0e0; padding: 4px 10px; border-radius: 12px; font-size: 11px; margin-right: 5px; margin-bottom: 5px; display: inline-block; }

/* Dropzone Mejorado */
.drop-zone { height: 110px; border: 2px dashed #eee; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fafafa; cursor: pointer; margin-bottom: 10px; transition: 0.3s; position: relative; overflow: hidden; }
.drop-zone:hover, .drop-zone--over { border-color: #000; background: #f0f0f0; }
.drop-zone__prompt { font-size: 11px; color: #aaa; font-weight: bold; text-transform: uppercase; text-align: center; }
.drop-zone__input { display: none; }
.img-preview { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: #fff; }
.img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.remove-img-btn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: #fff; border: none; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.remove-img-btn:hover { background: #000; }
.ref-preview { height: 70px !important; }

/* Botón Guardar */
.btn-black { background: #000 !important; color: #fff !important; border: none; padding: 18px; border-radius: 8px; width: 100%; font-weight: bold; cursor: pointer; text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }

/* Borrar carta */
.delete { position: absolute; top: 10px; right: 10px; }
.delete button { background: #000; color: #fff; border: none; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; }

/* --- MODAL Y LOGIN --- */
#modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 2000; align-items: center; justify-content: center; padding: 20px; }
.modal-content { display: flex; background: #fff; width: 100%; max-width: 1600px; height: 95vh; border-radius: 20px; overflow: hidden; }
.modal-images { flex: 1.8; background: #111; display: flex; flex-direction: column; padding: 10px; }
.modal-img-container { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 10px; min-height: 0; }
#mimg-link { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.modal-main-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.img-overlay { position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; background: rgba(0,0,0,0.2); border-radius: 8px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: 0.2s; }
.img-overlay span { color: #fff; font-size: 40px; }
#mimg-link:hover .img-overlay { opacity: 1; }
.modal-ref-container { background: #1a1a1a; padding: 10px 12px; flex-shrink: 0; display: flex; gap: 12px; align-items: center; }
.ref-img-wrapper { position: relative; flex-shrink: 0; }
#mref-link { display: block; position: relative; }
.modal-ref-img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; display: block; }
.ref-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); border-radius: 6px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: 0.2s; }
.ref-overlay span { color: #fff; font-size: 16px; }
#mref-link:hover .ref-overlay { opacity: 1; }
.modal-ref-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ref-label { color: #888; font-size: 9px; text-transform: uppercase; }
.ref-url-link { display: block; color: #666; font-size: 9px; word-break: break-all; text-decoration: none; }
.ref-url-link:hover { color: #fff; }
.modal-right { flex: 1; padding: 25px; display: flex; flex-direction: column; overflow-y: auto; min-width: 350px; max-width: 500px; }
#mprompt { flex-grow: 1; background: #f8f8f8; padding: 20px; border-radius: 10px; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; font-family: monospace; border: 1px solid #eee; margin-bottom: 15px; font-size: 13px; min-height: 100px; }

.login-box { background: #fff; border: 1px solid #eee; padding: 40px; border-radius: 20px; width: 360px; text-align: center; }
.btn-eye { position: absolute; right: 12px; bottom: 24px; font-size: 9px; cursor: pointer; font-weight: bold; color: #aaa; text-transform: uppercase; }

footer { padding: 30px 20px; text-align: center; border-top: 1px solid #eee; font-size: 12px; color: #888; }
.footer-link { color: #000; font-weight: 700; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

.go-top-btn { position: fixed; bottom: 30px; right: 30px; background: #000; color: #fff; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; text-decoration: none; z-index: 999; transition: 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.go-top-btn:hover { background: #333; transform: translateY(-3px); }
.loader { text-align: center; padding: 20px; color: #888; font-size: 12px; }

/* --- RESPONSIVE --- */
@media (max-width: 1200px) {
    .gallery { column-count: 4; }
}

@media (max-width: 1024px) {
    .gallery { column-count: 3; }
}

@media (max-width: 1024px) {
    .gallery { column-count: 3; }
}

@media (max-width: 768px) {
    header { padding: 0 15px; height: 60px; }
    header img { height: 25px; }
    .brand-title { font-size: 9px; margin-left: 8px; padding-left: 8px; }
    .welcome-text { display: none; }
    
    .form-columns { flex-direction: column; gap: 20px; }
    .column-left, .column-right { flex: none; width: 100%; }
    .container-small { padding: 0 15px; }
    .upload-section { padding: 20px 0; }
    
    .main-container { padding: 0 15px; }
    .tags-row { flex-wrap: wrap; overflow: visible; }
    .tags-row .filter-pill { visibility: visible !important; white-space: normal; }
    .gallery { column-count: 2; column-gap: 12px; }
    
    .modal-content { flex-direction: column; height: auto; max-height: 90vh; }
    .modal-images { padding: 15px; }
    .modal-img-container { max-height: 300px; }
    .modal-right { padding: 20px; min-width: auto; max-width: 100%; }
    
    .login-box { width: 100%; max-width: 360px; padding: 30px; }
}

@media (max-width: 480px) {
    .gallery { column-count: 2; }
    textarea { height: 200px; }
}
