{% extends 'layouts/base.html' %}
{% load static i18n %}

{% block title %}{% trans "Roadmap" %}{% endblock title %}

{% block extrastyle %}
<link rel="stylesheet" href="{% static 'css/dashboard-custom.css' %}">
<style>
  @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600&display=swap');

  .roadmap-bg {
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #121220 100%);
    color: #f8f9fa;
    padding: 50px 0;
    min-height: 100vh;
  }

  .roadmap-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: #00d9ff;
    text-align: center;
    margin-bottom: 3rem;
    text-shadow: 0 0 20px rgba(13, 217, 255, 0.5);
  }

  .roadmap-subtitle {
    color: #b8c2cc;
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 4rem;
  }

  .timeline-container {
    position: relative;
    padding: 2rem 0;
  }

  .timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6f42c1, #00d9ff, #6f42c1);
    transform: translateY(-50%);
    z-index: 1;
  }

  .timeline-items {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
  }

  .timeline-item {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #6f42c1;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(111, 66, 193, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }

  .timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6f42c1, #00d9ff);
  }

  .timeline-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(111, 66, 193, 0.4);
    border-color: #00d9ff;
  }

  .timeline-item:hover::before {
    background: linear-gradient(90deg, #00d9ff, #6f42c1);
  }

  .status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
  }

  .status-planned {
    background: linear-gradient(45deg, #17a2b8, #138496);
    color: white;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
  }

  .status-in_progress {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
  }

  .status-completed {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
  }

  .item-date {
    color: #00d9ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
  }

  .item-title {
    color: #f8f9fa;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.4;
  }

  .item-summary {
    color: #b8c2cc;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
  }

  .read-more-btn {
    display: inline-block;
    background: linear-gradient(45deg, #6f42c1, #e83e8c);
    border: none;
    border-radius: 50px;
    padding: 10px 25px;
    color: white;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.4);
  }

  .read-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.6);
    color: white;
    text-decoration: none;
  }

  .empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #6f42c1;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(111, 66, 193, 0.3);
  }

  .empty-state i {
    font-size: 4rem;
    color: #6f42c1;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(111, 66, 193, 0.5);
  }

  .empty-state h5 {
    color: #f8f9fa;
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .empty-state p {
    color: #b8c2cc;
    font-size: 1.1rem;
  }

  .disabled-btn {
    background: linear-gradient(45deg, #6c757d, #495057) !important;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4) !important;
    cursor: not-allowed !important;
  }

  .disabled-btn:hover {
    transform: none !important;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4) !important;
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .fade-in-up {
    animation: fadeInUp 0.6s ease-out;
  }

  .timeline-item:nth-child(1) { animation-delay: 0.1s; }
  .timeline-item:nth-child(2) { animation-delay: 0.2s; }
  .timeline-item:nth-child(3) { animation-delay: 0.3s; }
  .timeline-item:nth-child(4) { animation-delay: 0.4s; }
  .timeline-item:nth-child(5) { animation-delay: 0.5s; }
  .timeline-item:nth-child(6) { animation-delay: 0.6s; }

  @media (max-width: 768px) {
    .roadmap-title {
      font-size: 2.5rem;
    }
    
    .timeline-items {
      flex-direction: column;
      align-items: center;
    }
    
    .timeline-item {
      min-width: 100%;
      max-width: 100%;
    }
    
    .timeline-line {
      display: none;
    }
  }

  @media (min-width: 769px) and (max-width: 1200px) {
    .timeline-items {
      justify-content: center;
    }
    
    .timeline-item {
      min-width: 300px;
      max-width: 400px;
    }
  }

  /* Paginação */
  .roadmap-pagination {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 2rem;
    margin-top: 3rem;
    box-shadow: 0 0 25px rgba(111, 66, 193, 0.3), 0 0 40px rgba(13, 217, 255, 0.2);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    text-align: center;
  }

  .roadmap-pagination::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #6f42c1, #00d9ff, #6f42c1);
    border-radius: 20px;
    padding: 2px;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: -1;
  }

  .pagination-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    color: #b8c2cc;
    font-size: 0.95rem;
  }

  .pagination-info span {
    color: #00d9ff;
    font-weight: 600;
  }

  .pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .pagination-btn {
    background: linear-gradient(135deg, #6f42c1, #00d9ff);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    border: none;
  }

  .pagination-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
  }

  .pagination-btn:hover::before {
    left: 100%;
  }

  .pagination-btn:hover {
    background: linear-gradient(135deg, #00d9ff, #6f42c1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 217, 255, 0.3);
    color: #ffffff;
    text-decoration: none;
  }

  .pagination-numbers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
  }

  .pagination-number {
    background: rgba(111, 66, 193, 0.2);
    color: #b8c2cc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(111, 66, 193, 0.3);
    min-width: 2.5rem;
    text-align: center;
  }

  .pagination-number:hover {
    background: rgba(111, 66, 193, 0.4);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
    text-decoration: none;
    border-color: #00d9ff;
  }

  .pagination-current {
    background: linear-gradient(135deg, #6f42c1, #00d9ff);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    min-width: 2.5rem;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(13, 217, 255, 0.4);
  }

  @media (max-width: 768px) {
    .roadmap-pagination {
      padding: 1.5rem;
      margin-top: 2rem;
    }

    .pagination-controls {
      flex-direction: column;
      gap: 1rem;
    }

    .pagination-numbers {
      order: 2;
    }

    .pagination-btn {
      order: 1;
      width: 100%;
      justify-content: center;
    }

    .pagination-info {
      flex-direction: column;
      gap: 0.5rem;
    }
  }
</style>
{% endblock extrastyle %}

{% block content %}
<div class="roadmap-bg">
  <div class="container">
    <!-- Header -->
    <div class="text-center fade-in-up">
      <h1 class="roadmap-title">
        <i class="fas fa-road me-3"></i>
        {% trans "Roadmap" %}
      </h1>
      <p class="roadmap-subtitle">
        {% trans "Acompanhe o desenvolvimento e as novidades do projeto" %}
      </p>
    </div>

    <!-- Timeline -->
    <div class="timeline-container">
      <div class="timeline-line"></div>
      
      <div class="timeline-items">
        {% for item in items %}
        <div class="timeline-item fade-in-up">
          <div class="status-badge status-{{ item.roadmap.status }}">
            {% if item.roadmap.status == 'planned' %}
              <i class="fas fa-calendar-plus me-1"></i>
              {% trans "Planejado" %}
            {% elif item.roadmap.status == 'in_progress' %}
              <i class="fas fa-tools me-1"></i>
              {% trans "Em Andamento" %}
            {% elif item.roadmap.status == 'completed' %}
              <i class="fas fa-check-circle me-1"></i>
              {% trans "Concluído" %}
            {% endif %}
          </div>
          
          <div class="item-date">
            <i class="fas fa-calendar-alt me-2"></i>
            {{ item.roadmap.pub_date|date:'d/m/Y' }}
          </div>
          
          <h5 class="item-title">{{ item.translation.title }}</h5>
          
          <p class="item-summary">
            {{ item.translation.summary|default:item.translation.content|truncatewords:25 }}
          </p>
          
          <a href="{% url 'roadmap:detail' item.roadmap.slug %}" class="read-more-btn">
            <i class="fas fa-arrow-right me-2"></i>
            {% trans "Leia mais" %}
          </a>
        </div>
        {% empty %}
        <div class="timeline-item empty-state fade-in-up">
          <i class="fas fa-calendar-times"></i>
          <h5>{% trans "Nenhum item de roadmap disponível" %}</h5>
          <p>{% trans "Aguarde novidades em breve!" %}</p>
          <a href="#" class="read-more-btn disabled-btn" tabindex="-1" aria-disabled="true">
            <i class="fas fa-clock me-2"></i>
            {% trans "Em breve" %}
          </a>
        </div>
        {% endfor %}
      </div>
    </div>

    <!-- Paginação -->
    {% if has_other_pages %}
      <div class="mt-4">
        {% with query_params=request.GET.urlencode %}
          {% include 'includes/pagination.html' %}
        {% endwith %}
      </div>
    {% endif %}
  </div>
</div>
{% endblock content %}

{% block extra_js %}
<!-- JS extra, se necessário -->
{% endblock extra_js %}
