/* ============================================
   ALHOSTINGS CLIENT PORTAL - Styles
   Color palette: #5B8DB8 (blue), #222 (dark), #f5f7fa (bg)
   ============================================ */

:root {
  --blue:       #5B8DB8;
  --blue-dark:  #3d6d96;
  --blue-light: #e8f1f8;
  --dark:       #1e2530;
  --gray:       #6b7280;
  --gray-light: #e5e7eb;
  --bg:         #f5f7fa;
  --white:      #ffffff;
  --success:    #22c55e;
  --error:      #ef4444;
  --warning:    #f59e0b;
  --radius:     10px;
  --shadow:     0 2px 16px rgba(91,141,184,0.10);
  --shadow-lg:  0 8px 32px rgba(91,141,184,0.18);
  --font:       'DM Sans', 'Segoe UI', sans-serif;
  --font-mono:  'DM Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

/* ---- GOOGLE FONTS ---- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono&display=swap');

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f1f8 0%, #f5f7fa 60%, #dce9f4 100%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(91,141,184,0.12);
}

.login-logo {
  display: block;
  margin: 0 auto 28px;
  max-width: 180px;
  height: auto;
  opacity: 1;
  filter: none;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.88rem;
  color: var(--gray);
  text-align: center;
  margin-bottom: 30px;
}

.lang-switcher {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.lang-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-light);
  background: transparent;
  color: var(--gray);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.lang-btn:hover, .lang-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91,141,184,0.15);
  background: white;
}

.form-check-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.form-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--gray);
}

.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.form-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--blue-dark);
}

.form-link:hover {
  color: var(--blue);
}

.forgot-link-wrap {
  text-align: center;
  margin-top: 12px;
}

.forgot-link {
  font-size: 0.9rem;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--blue);
  color: white;
  width: 100%;
  justify-content: center;
  padding: 13px;
  font-size: 1rem;
}

.btn-primary:hover { background: var(--blue-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,141,184,0.35); }

.btn-secondary {
  background: var(--bg);
  color: var(--dark);
  border: 1.5px solid var(--gray-light);
}
.btn-secondary:hover { background: var(--gray-light); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; color: white; }

.btn-danger { background: #fee2e2; color: var(--error); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: var(--error); color: white; }

.btn-warning { background: #fef3c7; color: #92400e; border: 1.5px solid #fde68a; }
.btn-warning:hover { background: var(--warning); color: white; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: var(--blue-light); color: #1e3a5f; border: 1px solid #bfdbfe; }

/* ============================================
   PORTAL LAYOUT (Dashboard)
   ============================================ */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  padding: 28px 0 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-logo {
  display: block;
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}

.sidebar-logo img {
  max-width: 140px;
  filter: none;
  opacity: 1;
}

.sidebar-greeting {
  padding: 0 24px 16px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
}

.sidebar-greeting strong {
  display: block;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 3px;
  transition: all 0.2s;
  text-decoration: none;
}

.nav-item:hover, .nav-item.active {
  background: rgba(91,141,184,0.25);
  color: white;
}

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.lang-switcher-sidebar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.lang-btn-small {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}
.lang-btn-small:hover, .lang-btn-small.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
}
.logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,0.12); }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
  min-width: 0;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--gray);
  font-size: 0.9rem;
}

/* ============================================
   CATEGORY FILTER TABS
   ============================================ */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.filter-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-light);
  background: white;
  color: var(--gray);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.filter-tab:hover, .filter-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

/* ============================================
   REPORT CARDS
   ============================================ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.report-card {
  background: white;
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(91,141,184,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.report-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.report-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.icon-seo        { background: #e0f2fe; }
.icon-competencia{ background: #fef3c7; }
.icon-keywords   { background: #d1fae5; }
.icon-linkedin   { background: #dbeafe; }
.icon-google_ads { background: #fce7f3; }
.icon-altres     { background: #f3e8ff; }

.report-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--blue-dark);
}

.report-badge.pdf { background: #fee2e2; color: #b91c1c; }

.report-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.3;
}

.report-desc {
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.5;
}

.report-meta {
  font-size: 0.78rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: #1a1f2e;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-badge {
  margin: 0 16px 20px;
  background: rgba(91,141,184,0.2);
  border: 1px solid rgba(91,141,184,0.3);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 6px;
  text-align: center;
}

.table-container {
  background: white;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(91,141,184,0.08);
  overflow: hidden;
}

.table-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 12px 20px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  background: var(--bg);
  border-bottom: 1px solid var(--gray-light);
}

td {
  padding: 14px 20px;
  font-size: 0.88rem;
  color: var(--dark);
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--success); }
.dot-gray  { background: var(--gray-light); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,37,48,0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: 18px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: transform 0.25s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--gray);
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close:hover { background: var(--bg); }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-light);
}

/* ============================================
   PASSWORD REVEAL
   ============================================ */
.pass-reveal {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 16px;
  display: none;
}

.pass-reveal.show { display: block; }

.pass-reveal-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #166534;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pass-reveal-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: #15803d;
  letter-spacing: 0.05em;
  word-break: break-all;
}

/* ============================================
   FILE UPLOAD
   ============================================ */
.file-drop {
  border: 2px dashed var(--gray-light);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.file-drop:hover, .file-drop.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}

.file-drop-icon { font-size: 2rem; margin-bottom: 8px; }
.file-drop-text { font-size: 0.9rem; color: var(--gray); }
.file-drop-text strong { color: var(--blue); }
.file-name { margin-top: 12px; font-size: 0.85rem; font-weight: 600; color: var(--dark); }

/* ============================================
   SEARCH
   ============================================ */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 38px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .portal-layout, .admin-layout {
    flex-direction: column;
  }

  .sidebar, .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 16px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .sidebar-logo, .sidebar-greeting { display: none; }

  .main-content {
    padding: 20px;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 32px 24px;
  }

  table { display: block; overflow-x: auto; }
}
