/* ═══════════════════════════════════════════════════════════
   TECNOINFISSI INTRANET — Mobile-First CSS
   Brand: #f9ad4a (gold), #1a1a1a (dark), #f5f5f5 (bg)
   Fonts: Raleway (heading), Roboto (body)
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --accent: #f9ad4a;
  --accent-hover: #f6a131;
  --dark: #3a3a3a;
  --text: #4a4a4a;
  --text-light: #888;
  --bg: #f5f5f5;
  --white: #ffffff;
  --border: #e0e0e0;
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --header-h: 56px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  color: var(--dark);
}

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

/* ── Header ───────────────────────────────────────────────── */
.main-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--dark);
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 16px;
}

.header-logo img { height: 36px; display: block; }

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 48px; height: 48px;
  background: none; border: none;
  cursor: pointer;
  padding: 12px;
}
.hamburger span {
  display: block; height: 2px; width: 24px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.main-nav {
  display: none;
  position: fixed;
  top: var(--header-h); left: 0; right: 0;
  background: var(--dark);
  padding: 8px 0;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 999;
}
.main-nav.open { display: flex; }

.nav-item {
  display: block;
  padding: 14px 24px;
  color: rgba(255,255,255,0.7);
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 15px;
  min-height: 48px;
  line-height: 20px;
}
.nav-item:hover, .nav-item.active {
  color: var(--white);
  background: rgba(249,173,74,0.1);
}
.nav-item.active { border-left: 3px solid var(--accent); }

/* Dropdown Menu */
.nav-dropdown { position: relative; }

.nav-dropdown-toggle { cursor: pointer; }

.nav-dropdown-menu {
  display: none;
  background: #2a2a2a;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  padding: 4px 0;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }

.dropdown-item {
  display: block;
  padding: 12px 24px 12px 40px;
  color: rgba(255,255,255,0.6);
  font-family: 'Raleway', sans-serif;
  font-weight: 500;
  font-size: 14px;
  min-height: 44px;
  line-height: 20px;
}
.dropdown-item:hover {
  color: var(--white);
  background: rgba(249,173,74,0.1);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--dark);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.user-info { display: none; }
.user-name { color: var(--white); font-size: 13px; font-weight: 500; }
.user-role { color: rgba(255,255,255,0.5); font-size: 11px; display: block; }

.btn-logout {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  border-radius: 50%;
}
.btn-logout:hover { color: var(--error); background: rgba(255,255,255,0.1); }

/* ── Main Content ─────────────────────────────────────────── */
.page-content {
  margin-top: var(--header-h);
  padding: 16px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash {
  padding: 12px 20px;
  margin: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 400;
  animation: flashIn 0.3s ease;
}
.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.flash-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.flash-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.flash-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

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

.card-title {
  font-size: 18px;
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  gap: 8px;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: var(--dark); }
.btn-primary:hover { background: var(--accent-hover); color: var(--dark); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #ccc; }

.btn-danger { background: var(--error); color: var(--white); }
.btn-danger:hover { background: #DC2626; }

.btn-sm { min-height: 36px; padding: 8px 16px; font-size: 13px; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  background: var(--white);
  color: var(--dark);
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,173,74,0.15);
}

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a4a4a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 12px;
  background: var(--bg);
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:hover td { background: rgba(249,173,74,0.04); }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0ede8;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  text-align: center;
}

.login-card h1 { color: var(--white); font-size: 20px; margin-bottom: 8px; }
.login-card .subtitle { color: rgba(255,255,255,0.5); }
.login-card .form-label { color: rgba(255,255,255,0.7); }
.login-card .form-control { background: #2a2a2a; border-color: #444; color: var(--white); }
.login-card .form-control:focus { border-color: var(--accent); }

.login-card img { height: 48px; margin-bottom: 24px; }
.login-card .subtitle { color: var(--text-light); font-size: 14px; margin-bottom: 32px; }

.login-error {
  background: #FEE2E2;
  color: #991B1B;
  padding: 10px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 22px; }

/* ── Utilities ────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ═══ TABLET (iPad) ═══════════════════════════════════════ */
@media (min-width: 768px) {
  :root { --header-h: 64px; }

  .hamburger { display: none; }

  .main-nav {
    display: flex;
    position: static;
    flex-direction: row;
    padding: 0;
    box-shadow: none;
    gap: 4px;
  }

  .nav-item {
    padding: 8px 14px;
    border-radius: var(--radius);
    min-height: 40px;
    border-left: none;
  }
  .nav-item.active {
    background: rgba(249,173,74,0.15);
    color: var(--accent);
    border-left: none;
  }

  .user-info { display: block; }

  .page-content { padding: 24px; }

  /* Dropdown desktop: hover */
  .nav-dropdown { position: relative; }
  .nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #2a2a2a;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    padding: 4px 0;
    z-index: 1001;
  }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown.open .nav-dropdown-menu { display: block; }

  .dropdown-item {
    padding: 10px 20px;
    min-height: 40px;
  }
}

/* ═══ DESKTOP ═════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .nav-item { padding: 8px 18px; font-size: 14px; }
  .page-content { padding: 32px; }
}
