/* ============================================
   FASSAAD.EE DEMO — Design System
   Inspireeritud Fassaad.ee stiilist, aga ilusam
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #F5F5F5;
  --bg-white: #FFFFFF;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --accent: #2C3E50;
  --accent-hover: #3498DB;
  --accent-light: #EBF5FB;
  --border: #E0E0E0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 50px;
  --max-width: 1200px;
  --header-height: 72px;
  --transition: 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

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

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 48px;
}

.section-title p {
  color: var(--text-light);
  margin-top: 12px;
  font-size: 1.1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* --- Header / Nav --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.nav a:hover,
.nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 32px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-sm {
  padding: 8px 20px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

/* --- Cards --- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all var(--transition);
}

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

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #D5D5D5, #BDBDBD);
}

.card-body {
  padding: 20px;
}

.card-body h3 {
  margin-bottom: 8px;
}

.card-body p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #2C3E50 0%, #34495E 50%, #2C3E50 100%);
  color: #fff;
  margin-top: var(--header-height);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="g" width="20" height="20" patternUnits="userSpaceOnUse"><rect width="20" height="20" fill="none"/><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect fill="url(%23g)" width="100" height="100"/></svg>');
  opacity: 0.5;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  padding: 40px 24px;
}

.hero h1 {
  color: #fff;
  font-size: 3rem;
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero .btn-primary {
  background: #fff;
  color: var(--accent);
}

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

.hero .btn-outline {
  border-color: #fff;
  color: #fff;
}

.hero .btn-outline:hover {
  background: #fff;
  color: var(--accent);
}

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

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-white);
  transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

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

/* --- Product Grid --- */
.product-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all var(--transition);
}

.product-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.product-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, #E8E8E8, #D0D0D0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.product-info {
  padding: 16px;
}

.product-info h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.product-info .category {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-info .price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
}

.product-info .unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.product-actions {
  padding: 0 16px 16px;
}

/* --- Filters --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
  align-items: center;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-white);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.search-box {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-white);
}

.search-box:focus {
  outline: none;
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* --- Cart --- */
.cart-badge {
  background: var(--accent-hover);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  vertical-align: middle;
}

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

.cart-table th,
.cart-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.cart-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.cart-table .qty-input {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.95rem;
}

.cart-total {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: right;
  padding: 24px 0;
}

.remove-btn {
  background: none;
  border: none;
  color: #E74C3C;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  transition: opacity var(--transition);
}

.remove-btn:hover {
  opacity: 0.7;
}

/* --- Intranet --- */
.login-box {
  max-width: 400px;
  margin: 120px auto 60px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 8px;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 32px;
}

.intranet-header {
  background: var(--accent);
  color: #fff;
}

.intranet-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intranet-header .logo {
  color: #fff;
}

.intranet-header .nav a {
  color: rgba(255,255,255,0.8);
}

.intranet-header .nav a:hover,
.intranet-header .nav a.active {
  color: #fff;
  border-bottom-color: #fff;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.object-field {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

/* --- Order Summary --- */
.order-summary {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 700px;
  margin: 0 auto;
}

.order-summary h2 {
  margin-bottom: 24px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.order-item:last-child {
  border-bottom: none;
}

/* --- Success Message --- */
.success-box {
  text-align: center;
  padding: 60px 24px;
  max-width: 500px;
  margin: 0 auto;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #27AE60;
  color: #fff;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

/* --- Footer --- */
.footer {
  background: var(--accent);
  color: rgba(255,255,255,0.8);
  padding: 48px 0 24px;
}

.footer h4 {
  color: #fff;
  margin-bottom: 16px;
}

.footer a {
  color: rgba(255,255,255,0.7);
}

.footer a:hover {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* --- Alerts --- */
.alert {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.alert-error {
  background: #FDEDEC;
  color: #C0392B;
  border: 1px solid #F5C6CB;
}

.alert-success {
  background: #EAFAF1;
  color: #27AE60;
  border: 1px solid #A9DFBF;
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 20px 0;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span {
  color: var(--text-muted);
}

/* --- Page Header --- */
.page-header {
  padding-top: calc(var(--header-height) + 40px);
  padding-bottom: 24px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .hero {
    min-height: 480px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-white);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 999;
  }

  .intranet-header .nav {
    background: var(--accent);
  }

  .nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .user-info {
    display: none;
  }

  .nav.open + .user-info,
  .nav.open ~ .user-info {
    display: none;
  }

  /* Show logout link in mobile nav */
  .nav.open .mobile-logout {
    display: block !important;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.2);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .section {
    padding: 48px 0;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .login-box {
    margin: 100px 16px 40px;
    padding: 24px;
  }
}
