/* Admin Panel - COSTA INMOBILIARIA */
:root {
  --brand: #E63946;
  --brand-dark: #B72832;
  --ink: #1A1F2E;
  --ink-soft: #2A2F3E;
  --cream: #F8F5F0;
  --bg: #F4F5F7;
  --border: #E5E1DA;
  --green: #10B981;
  --amber: #F59E0B;
  --font-display: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--bg); color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--font-display); }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 1rem; position: relative; overflow: hidden; }
.login-page::before { content: ''; position: absolute; left: -8rem; top: -8rem; width: 24rem; height: 24rem; border-radius: 50%; background: rgba(230,57,70,0.15); filter: blur(60px); }
.login-page::after { content: ''; position: absolute; right: -8rem; bottom: -8rem; width: 24rem; height: 24rem; border-radius: 50%; background: rgba(69,123,157,0.15); filter: blur(60px); }
.login-card { position: relative; width: 100%; max-width: 400px; overflow: hidden; border-radius: 1rem; border: 1px solid rgba(255,255,255,0.1); background: var(--ink-soft); box-shadow: 0 25px 50px rgba(0,0,0,0.3); }
.login-header { border-bottom: 1px solid rgba(255,255,255,0.1); background: rgba(26,31,46,0.5); padding: 1.5rem; text-align: center; }
.login-logo { height: 64px; margin: 0 auto; display: block; }
.login-header h1 { margin-top: 1rem; font-size: 1.25rem; color: white; }
.login-header p { margin-top: 0.25rem; font-size: 0.75rem; color: rgba(255,255,255,0.6); }
.login-body { padding: 1.5rem; }
.login-back { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-size: 0.875rem; color: rgba(255,255,255,0.6); }
.login-back:hover { color: var(--brand); }
.login-field { margin-bottom: 1rem; }
.login-field label { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.7); margin-bottom: 0.375rem; }
.login-field input { width: 100%; border-radius: 0.375rem; border: 1px solid rgba(255,255,255,0.1); background: var(--ink); padding: 0.625rem 1rem; font-size: 0.875rem; color: white; }
.login-field input:focus { outline: none; border-color: var(--brand); }
.login-btn { width: 100%; padding: 0.75rem; border-radius: 0.375rem; border: none; background: var(--brand); color: white; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-btn:hover { background: var(--brand-dark); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error { display: flex; align-items: center; gap: 0.5rem; border-radius: 0.375rem; border: 1px solid rgba(230,57,70,0.3); background: rgba(230,57,70,0.1); padding: 0.75rem; margin-bottom: 1rem; font-size: 0.875rem; color: var(--brand); }
.login-footer { border-top: 1px solid rgba(255,255,255,0.1); background: rgba(26,31,46,0.3); padding: 0.75rem 1.5rem; text-align: center; font-size: 11px; color: rgba(255,255,255,0.4); }

/* Admin Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; background: var(--ink); z-index: 50; transform: translateX(-100%); transition: transform 0.3s; display: flex; flex-direction: column; }
@media (min-width: 1024px) { .sidebar { transform: translateX(0); } }
.sidebar.open { transform: translateX(0); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; height: 64px; border-bottom: 1px solid rgba(255,255,255,0.1); padding: 0 1rem; }
.sidebar-logo { display: flex; align-items: center; gap: 0.5rem; }
.sidebar-logo img { height: 36px; }
.sidebar-logo-text { line-height: 1; }
.sidebar-logo-text p { font-size: 0.75rem; font-weight: 700; color: white; }
.sidebar-logo-text span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--brand); }
.sidebar-close { background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; padding: 0.25rem; }
@media (min-width: 1024px) { .sidebar-close { display: none; } }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem; }
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; color: rgba(255,255,255,0.7); margin-bottom: 0.25rem; transition: all 0.2s; }
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: white; }
.sidebar-link.active { background: var(--brand); color: white; box-shadow: 0 8px 16px rgba(230,57,70,0.3); }
.sidebar-link i { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding: 0.75rem; }
.sidebar-external { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-radius: 0.5rem; font-size: 0.75rem; color: rgba(255,255,255,0.6); }
.sidebar-external:hover { background: rgba(255,255,255,0.05); color: white; }
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; margin-top: 0.5rem; }
.sidebar-avatar { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); font-size: 0.75rem; font-weight: 700; color: white; }
.sidebar-user-info { flex: 1; line-height: 1; }
.sidebar-user-info p { font-size: 0.75rem; font-weight: 600; color: white; }
.sidebar-user-info span { font-size: 10px; color: rgba(255,255,255,0.5); }
.sidebar-logout { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; padding: 0.375rem; border-radius: 0.375rem; }
.sidebar-logout:hover { background: rgba(255,255,255,0.05); color: var(--brand); }

.main-area { flex: 1; padding-left: 0; }
@media (min-width: 1024px) { .main-area { padding-left: 256px; } }
.mobile-header { display: flex; align-items: center; justify-content: space-between; height: 64px; border-bottom: 1px solid var(--border); background: white; padding: 0 1rem; }
@media (min-width: 1024px) { .mobile-header { display: none; } }
.mobile-menu-btn { background: none; border: none; cursor: pointer; padding: 0.5rem; color: var(--ink); }
.mobile-title { font-family: var(--font-display); font-size: 0.875rem; font-weight: 700; }
.main-content { padding: 1rem; }
@media (min-width: 640px) { .main-content { padding: 1.5rem; } }
@media (min-width: 1024px) { .main-content { padding: 2rem; } }

.sidebar-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.5); }
@media (min-width: 1024px) { .sidebar-overlay { display: none; } }

/* Page header */
.page-header { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 640px) { .page-header { flex-direction: row; align-items: center; justify-content: space-between; } }
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: rgba(26,31,46,0.5); }
.breadcrumb a:hover { color: var(--brand); }
.page-header h1 { margin-top: 0.25rem; font-size: 1.5rem; font-weight: 700; }
@media (min-width: 1024px) { .page-header h1 { font-size: 1.875rem; } }
.page-header p { margin-top: 0.25rem; font-size: 0.875rem; color: rgba(26,31,46,0.6); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border-radius: 0.375rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; font-family: var(--font-body); transition: all 0.2s; }
.btn-primary { background: var(--brand); color: white; box-shadow: 0 4px 12px rgba(230,57,70,0.2); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: white; border: 1px solid var(--border); color: rgba(26,31,46,0.8); }
.btn-outline:hover { background: var(--cream); }
.btn-dark { background: var(--ink); color: white; }
.btn-dark:hover { background: var(--ink-soft); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn i { width: 16px; height: 16px; }

/* Cards */
.card { border-radius: 0.75rem; border: 1px solid var(--border); background: white; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
@media (min-width: 640px) { .card { padding: 1.5rem; } }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { border-radius: 0.75rem; border: 1px solid var(--border); background: white; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: all 0.3s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0,0,0,0.1); }
.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-card-label { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(26,31,46,0.5); }
.stat-card-value { margin-top: 0.5rem; font-family: var(--font-display); font-size: 1.875rem; font-weight: 700; }
.stat-card-sub { margin-top: 0.25rem; font-size: 0.75rem; color: rgba(26,31,46,0.4); }
.stat-card-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 0.5rem; color: white; }
.stat-card-icon i { width: 20px; height: 20px; }
.bg-brand { background: var(--brand); }
.bg-green { background: var(--green); }
.bg-steel { background: #457B9D; }
.bg-amber { background: var(--amber); }
.bg-purple { background: #8B5CF6; }
.bg-pink { background: #EC4899; }
.bg-indigo { background: #6366F1; }
.bg-orange { background: #F97316; }

/* Toolbar */
.toolbar { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 640px) { .toolbar { flex-direction: row; align-items: center; justify-content: space-between; } }
.search-wrap { position: relative; width: 100%; max-width: 320px; }
.search-wrap i { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: rgba(26,31,46,0.4); }
.search-wrap input { width: 100%; border-radius: 0.375rem; border: 1px solid var(--border); background: white; padding: 0.5rem 1rem 0.5rem 2.5rem; font-size: 0.875rem; }

/* List items */
.list-item { display: flex; align-items: center; gap: 0.75rem; border-radius: 0.5rem; border: 1px solid var(--border); background: white; padding: 0.75rem; transition: all 0.2s; }
.list-item:hover { border-color: rgba(230,57,70,0.2); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.list-item + .list-item { margin-top: 0.5rem; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 0.875rem; font-weight: 700; color: var(--ink); }
.list-item-meta { margin-top: 0.125rem; font-size: 0.75rem; color: rgba(26,31,46,0.5); }
.list-item-actions { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.icon-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 0.375rem; border: none; background: none; cursor: pointer; color: rgba(26,31,46,0.6); transition: all 0.2s; }
.icon-btn:hover { background: rgba(230,57,70,0.1); color: var(--brand); }
.icon-btn i { width: 16px; height: 16px; }
.icon-btn-green:hover { background: rgba(16,185,129,0.1); color: var(--green); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.badge-green { background: rgba(16,185,129,0.1); color: #047857; }
.badge-gray { background: rgba(26,31,46,0.1); color: rgba(26,31,46,0.5); }
.badge-brand { background: rgba(230,57,70,0.1); color: var(--brand); }
.badge-amber { background: rgba(245,158,11,0.1); color: #92400E; }
.badge-steel { background: rgba(69,123,157,0.1); color: #457B9D; }

/* Thumb */
.thumb { width: 80px; height: 48px; border-radius: 0.375rem; overflow: hidden; background: var(--cream); flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: rgba(26,31,46,0.2); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0,0,0,0.6); }
.modal { width: 100%; max-width: 768px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; border-radius: 0.75rem; background: white; box-shadow: 0 25px 50px rgba(0,0,0,0.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 1.25rem 1.5rem; }
.modal-header h3 { font-size: 1.125rem; font-weight: 700; }
.modal-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; border-top: 1px solid var(--border); padding: 1.25rem 1.5rem; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
.form-group { }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(26,31,46,0.7); margin-bottom: 0.375rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; border-radius: 0.375rem; border: 1px solid var(--border); background: white; padding: 0.5rem 0.75rem; font-size: 0.875rem; color: var(--ink); font-family: var(--font-body); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.form-group textarea { resize: vertical; }
.form-group .help { margin-top: 0.25rem; font-size: 0.75rem; color: rgba(26,31,46,0.5); }
.form-group .req { color: var(--brand); }
.toggle { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.toggle input { width: 44px; height: 24px; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { position: relative; padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 500; color: rgba(26,31,46,0.6); background: none; border: none; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); }
.tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); }

/* Messages */
.message-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 70vh; overflow-y: auto; }
.message-item { display: flex; align-items: flex-start; gap: 0.75rem; border-radius: 0.5rem; border: 1px solid var(--border); background: white; padding: 0.75rem; cursor: pointer; transition: all 0.2s; }
.message-item:hover { border-color: rgba(230,57,70,0.3); }
.message-item.selected { border-color: var(--brand); background: rgba(230,57,70,0.05); }
.message-item.unread { border-color: rgba(230,57,70,0.3); }
.message-avatar { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(26,31,46,0.05); color: rgba(26,31,46,0.5); flex-shrink: 0; }
.message-item.unread .message-avatar { background: var(--brand); color: white; }
.message-content { flex: 1; min-width: 0; }
.message-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.message-name { font-size: 0.875rem; font-weight: 700; color: var(--ink); }
.message-item.unread .message-name { font-weight: 700; }
.message-date { font-size: 10px; color: rgba(26,31,46,0.4); flex-shrink: 0; }
.message-subject { margin-top: 0.125rem; font-size: 0.75rem; font-weight: 500; color: rgba(26,31,46,0.8); }
.message-preview { margin-top: 0.125rem; font-size: 0.75rem; color: rgba(26,31,46,0.4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 0.75rem; border-radius: 0.5rem; padding: 1rem; font-size: 0.875rem; margin-bottom: 1rem; }
.alert-success { border: 1px solid rgba(16,185,129,0.3); background: rgba(16,185,129,0.1); color: #047857; }
.alert-error { border: 1px solid rgba(230,57,70,0.3); background: rgba(230,57,70,0.1); color: var(--brand); }
.alert-info { border: 1px solid rgba(69,123,157,0.3); background: rgba(69,123,157,0.1); color: #457B9D; }
.alert i { width: 20px; height: 20px; flex-shrink: 0; }

/* Empty state */
.empty { text-align: center; padding: 3rem; border: 2px dashed var(--border); border-radius: 0.75rem; color: rgba(26,31,46,0.5); font-size: 0.875rem; }

/* Info banner */
.info-banner { display: flex; align-items: flex-start; gap: 0.75rem; border-radius: 0.5rem; border: 1px solid rgba(69,123,157,0.2); background: rgba(69,123,157,0.05); padding: 1rem; margin-bottom: 1.25rem; }
.info-banner i { width: 20px; height: 20px; flex-shrink: 0; color: #457B9D; margin-top: 2px; }
.info-banner p { font-size: 0.875rem; color: rgba(26,31,46,0.7); }
.info-banner strong { color: var(--ink); }
