/**
 * Frontend Styles for HomeAwe Connect
 * Modern, RTL-friendly, cache-safe design with HomeAwe palette
 */

:root {
  --hac-accent: #E4C537;
  --hac-bg: #ffffff;
  --hac-fg: #333333;
  --hac-muted: #f8f9fa;
  --hac-border: rgba(0,0,0,.12);
  --hac-radius: 10px;
  --hac-shadow: 0 4px 20px rgba(0,0,0,0.1);
  --hac-transition: all 0.3s ease;
}

* { box-sizing: border-box; }

.hac-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.hac-wide-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* Buttons */
.hac-btn {
  background: var(--hac-accent);
  color: #000;
  border: none;
  border-radius: var(--hac-radius);
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: var(--hac-transition);
  text-align: center;
}

.hac-btn:hover {
  background: #d4b530;
  transform: translateY(-2px);
}

.hac-btn-large {
  padding: 16px 32px;
  font-size: 18px;
}

.hac-btn-secondary {
  background: transparent;
  color: var(--hac-accent);
  border: 2px solid var(--hac-accent);
}

.hac-btn-secondary:hover {
  background: var(--hac-accent);
  color: #000;
}

/* Multi-Step Form */
.hac-form {
  background: var(--hac-bg);
  color: var(--hac-fg);
  border-radius: var(--hac-radius);
  box-shadow: var(--hac-shadow);
  overflow: hidden;
  margin: 2rem auto;
}

/* Step Progress */
.hac-steps {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 2rem;
  background: var(--hac-muted);
  flex-wrap: wrap;
  justify-content: center;
  border-bottom: 1px solid #e0e0e0;
}

.hac-step-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 80px;
  flex-shrink: 0;
}

.hac-step {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s transform, 0.3s background;
  font-weight: 700;
  border: 3px solid transparent;
  font-size: 16px;
}

.hac-step.active {
  background: var(--hac-accent);
  color: #000;
  transform: scale(1.1);
  border-color: var(--hac-accent);
  box-shadow: 0 0 0 3px rgba(228, 197, 55, 0.3);
}

.hac-step.completed {
  background: #28a745;
  color: #fff;
  border-color: #28a745;
}

.hac-step.completed::before {
  content: '✓';
  font-size: 14px;
  font-weight: bold;
}

.hac-step-title {
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
  color: var(--hac-fg);
  line-height: 1.3;
  word-wrap: break-word;
  hyphens: auto;
}

/* Form Panes */
.hac-pane {
  padding: 3rem;
  min-height: 500px;
  display: none;
  animation: hacFade 0.25s ease;
}

.hac-pane.active {
  display: block;
}

@keyframes hacFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hac-pane h3 {
  color: var(--hac-accent);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.hac-pane h3::before {
  content: '';
  width: 4px;
  height: 30px;
  background: var(--hac-accent);
  margin-right: 15px;
  border-radius: 2px;
}

.hac-rtl .hac-pane h3::before {
  margin-right: 0;
  margin-left: 15px;
}

.hac-pane p {
  color: #666;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Form Fields */
.hac-form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.hac-form-row .hac-form-field {
  flex: 1;
}

@media (max-width: 768px) {
  .hac-form-row {
    flex-direction: column;
    gap: 0;
  }
}

.hac-form-field {
  margin-bottom: 1.5rem;
}

.hac-form-field label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--hac-fg);
  font-size: 14px;
}

.hac-form-field label.required::after {
  content: ' *';
  color: #dc3545;
}

.hac-form-field input,
.hac-form-field select,
.hac-form-field textarea {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e0e0e0;
  border-radius: var(--hac-radius);
  font-size: 16px;
  background: #ffffff;
  color: var(--hac-fg);
  transition: var(--hac-transition);
}

.hac-form-field input:focus,
.hac-form-field select:focus,
.hac-form-field textarea:focus {
  outline: none;
  border-color: var(--hac-accent);
  box-shadow: 0 0 0 4px rgba(228, 197, 55, 0.2);
}

.hac-form-field textarea {
  min-height: 120px;
  resize: vertical;
}

.hac-form-field input[type="checkbox"] {
  width: auto;
  margin-right: 12px;
  transform: scale(1.2);
}

.hac-rtl .hac-form-field input[type="checkbox"] {
  margin-right: 0;
  margin-left: 12px;
}

.hac-form-field input[type="file"] {
  padding: 12px;
  border-style: dashed;
  background: var(--hac-muted);
  cursor: pointer;
}

/* Checkbox Groups */
.hac-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hac-checkbox-item {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--hac-radius);
  transition: var(--hac-transition);
  cursor: pointer;
}

.hac-checkbox-item:hover {
  background: var(--hac-muted);
}

.hac-checkbox-item label {
  margin-bottom: 0;
  cursor: pointer;
  line-height: 1.4;
}

/* Form Validation */
.hac-form-field.error input,
.hac-form-field.error select,
.hac-form-field.error textarea {
  border-color: #dc3545;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
}

.hac-form-field .error-message {
  color: #dc3545;
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  align-items: center;
}

.hac-form-field .error-message::before {
  content: '⚠';
  margin-right: 6px;
  font-size: 12px;
}

.hac-rtl .hac-form-field .error-message::before {
  margin-right: 0;
  margin-left: 6px;
}

/* Form Navigation */
.hac-form-nav {
  padding: 2rem 3rem;
  background: var(--hac-muted);
  border-top: 1px solid var(--hac-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hac-btn-prev {
  background: transparent;
  color: var(--hac-fg);
  border: 2px solid var(--hac-border);
}

.hac-btn-prev:hover {
  background: var(--hac-border);
  color: var(--hac-fg);
}

.hac-form-step-info {
  color: #666;
  font-size: 14px;
}

/* Landing Page */
.hac-landing {
  background: var(--hac-bg);
  color: var(--hac-fg);
  min-height: 100vh;
  padding: 3rem 0;
}

.hac-hero {
  text-align: center;
  padding: 5rem 0;
  background: linear-gradient(135deg, var(--hac-bg) 0%, var(--hac-muted) 100%);
  border-radius: var(--hac-radius);
  margin-bottom: 3rem;
}

.hac-hero h1 {
  font-size: 3rem;
  font-weight: 800;
  color: var(--hac-accent);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hac-hero p {
  font-size: 1.25rem;
  color: #666;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hac-hero-actions {
  margin-top: 2rem;
}

.hac-hero-actions .hac-btn {
  margin: 0 10px 10px 0;
}

.hac-rtl .hac-hero-actions .hac-btn {
  margin: 0 0 10px 10px;
}

/* Login Page */
.hac-login-page {
  background: var(--hac-bg);
  color: var(--hac-fg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hac-login-form {
  background: var(--hac-muted);
  padding: 3rem;
  border-radius: var(--hac-radius);
  box-shadow: var(--hac-shadow);
  max-width: 400px;
  width: 100%;
}

.hac-login-form h2 {
  color: var(--hac-accent);
  text-align: center;
  margin-bottom: 2rem;
}

/* Dashboard */
.hac-dashboard {
  background: var(--hac-bg);
  color: var(--hac-fg);
  min-height: 100vh;
  padding: 2rem 0;
}

.hac-dashboard-header {
  background: var(--hac-muted);
  padding: 2rem;
  border-radius: var(--hac-radius);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hac-dashboard-nav {
  background: var(--hac-muted);
  border-radius: var(--hac-radius);
  padding: 1rem;
  margin-bottom: 2rem;
}

.hac-dashboard-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
}

.hac-dashboard-nav a {
  color: var(--hac-fg);
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--hac-radius);
  transition: var(--hac-transition);
}

.hac-dashboard-nav a:hover,
.hac-dashboard-nav a.active {
  background: var(--hac-accent);
  color: #000;
}

.hac-dashboard-content {
  background: var(--hac-muted);
  padding: 2rem;
  border-radius: var(--hac-radius);
  min-height: 400px;
}

/* Opportunities Archive */
.hac-opportunities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.hac-opportunity-card {
  background: var(--hac-muted);
  border-radius: var(--hac-radius);
  padding: 2rem;
  transition: var(--hac-transition);
  border: 1px solid var(--hac-border);
}

.hac-opportunity-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--hac-shadow);
}

.hac-opportunity-card h3 {
  color: var(--hac-accent);
  margin-bottom: 1rem;
}

.hac-opportunity-card p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Loading & Notifications */
.hac-loading {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.hac-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 400px;
  padding: 1rem 1.5rem;
  border-radius: var(--hac-radius);
  color: var(--hac-fg);
  font-weight: 500;
  z-index: 10000;
  box-shadow: var(--hac-shadow);
  animation: slideIn 0.3s ease forwards;
  cursor: pointer;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.hac-notification-success { background: #28a745; }
.hac-notification-error { background: #dc3545; }
.hac-notification-info { background: #17a2b8; }

/* RTL Support */
.hac-rtl {
  direction: rtl;
  text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
  .hac-container, .hac-wide-container {
    padding: 15px;
  }
  
  .hac-pane {
    padding: 2rem 1.5rem;
  }
  
  .hac-form-nav {
    padding: 1.5rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .hac-hero h1 {
    font-size: 2.5rem;
  }
  
  /* Mobile Steps - Show current step only */
  .hac-steps {
    padding: 1rem;
    gap: 10px;
    flex-direction: column;
    align-items: center;
    position: relative;
  }
  
  /* Hide all steps by default on mobile */
  .hac-step-wrapper {
    display: none;
  }
  
  /* Show only active or completed step */
  .hac-step-wrapper:has(.hac-step.active),
  .hac-step-wrapper:has(.hac-step.completed) {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100px;
  }
  
  .hac-step {
    width: 48px;
    height: 48px;
    font-size: 16px;
    font-weight: bold;
  }
  
  .hac-step-title {
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    line-height: 1.2;
  }
  
  /* Progress indicator */
  .hac-steps::before {
    content: "الخطوة " attr(data-current) " من " attr(data-total);
    font-size: 14px;
    color: var(--hac-fg);
    font-weight: 600;
    margin-bottom: 8px;
  }
  
  .hac-dashboard-nav ul {
    flex-direction: column;
  }
  
  .hac-opportunities-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hac-pane {
    padding: 1.5rem 1rem;
    min-height: 400px;
  }
  
  .hac-hero h1 {
    font-size: 2rem;
  }
  
  .hac-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  /* Alternative: Simple progress dots for very small screens */
  .hac-steps {
    padding: 0.75rem 1rem;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
  }
  
  /* Hide step wrappers completely */
  .hac-step-wrapper {
    display: none !important;
  }
  
  /* Show simple progress dots */
  .hac-steps::before {
    content: "";
    display: flex;
    gap: 6px;
    align-items: center;
  }
  
  /* Create 8 progress dots with CSS counters */
  .hac-steps::after {
    content: "● ● ● ● ● ● ● ●";
    font-size: 12px;
    color: #ddd;
    letter-spacing: 8px;
    line-height: 1;
  }
  
  /* Current step indicator below dots */
  .hac-steps {
    position: relative;
  }
  
  .hac-steps[data-current="1"]::after {
    content: "● ○ ○ ○ ○ ○ ○ ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="2"]::after {
    content: "● ● ○ ○ ○ ○ ○ ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="3"]::after {
    content: "● ● ● ○ ○ ○ ○ ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="4"]::after {
    content: "● ● ● ● ○ ○ ○ ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="5"]::after {
    content: "● ● ● ● ● ○ ○ ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="6"]::after {
    content: "● ● ● ● ● ● ○ ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="7"]::after {
    content: "● ● ● ● ● ● ● ○";
    color: var(--hac-accent);
  }
  
  .hac-steps[data-current="8"]::after {
    content: "● ● ● ● ● ● ● ●";
    color: #28a745;
  }
}

/* Opportunity Form Tabs */
.hac-create-opportunity-form {
    max-width: 800px;
    margin: 0 auto;
}

.hac-form-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1rem;
}

.hac-tab {
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    min-width: 120px;
    text-align: center;
}

.hac-tab:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.hac-tab.active {
    background: linear-gradient(135deg, #e4c537 0%, #d4b530 100%);
    color: white;
    border-color: #d4b530;
    box-shadow: 0 2px 8px rgba(228, 197, 55, 0.3);
}

.hac-pane {
    display: none;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.hac-pane.active {
    display: block;
}

.hac-pane h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f8f9fa;
}

.hac-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.hac-btn-secondary {
    background: #6c757d;
    color: white;
}

.hac-btn-secondary:hover {
    background: #5a6268;
}

.hac-btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.hac-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.hac-form-field small {
    display: block;
    margin-top: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Responsive tabs */
@media (max-width: 768px) {
    .hac-form-tabs {
        justify-content: center;
    }
    
    .hac-tab {
        flex: 1;
        min-width: 100px;
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .hac-pane {
        padding: 1rem;
    }
    
    .hac-form-navigation {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hac-form-navigation button {
        width: 100%;
    }
}