/* ============================================
   EbookStore - Professional Dark Theme CSS
   Mobile-First Responsive Design
   ============================================ */

/* Variables */
:root {
    --primary: #6c63ff;
    --primary-dark: #5a52d5;
    --primary-light: #8b85ff;
    --bg-dark: #1a1a2e;
    --bg-darker: #16213e;
    --bg-card: #1e2a4a;
    --bg-card-hover: #243b6e;
    --text-primary: #ffffff;
    --text-secondary: #b0b3c5;
    --text-muted: #7f8299;
    --accent: #e94560;
    --success: #00c897;
    --warning: #ffc107;
    --danger: #e94560;
    --border: #2a2d4a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 35px rgba(108, 99, 255, 0.25);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   HEADER & NAVBAR
   ============================================ */
.header {
    background: var(--bg-darker);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i { color: var(--primary); font-size: 1.5rem; }

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

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
}

.nav-menu li a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-menu li a:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Dropdown */
.dropdown, .user-dropdown { position: relative; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 200px;
    padding: 8px 0;
    box-shadow: var(--shadow);
    z-index: 1000;
    list-style: none;
    margin-top: 5px;
}

.user-dropdown .dropdown-menu {
    left: auto !important;
    right: 0 !important;
}

.dropdown:hover .dropdown-menu,
.user-dropdown:hover .dropdown-menu { display: block; }

.dropdown-menu li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dropdown-menu li a:hover {
    background: var(--primary);
    color: white;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
}

.user-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

/* Search */
.search-form {
    display: flex;
    flex: 1;
    max-width: 300px;
}

.search-input {
    flex: 1;
    padding: 8px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus { border-color: var(--primary); }

.search-btn {
    padding: 8px 15px;
    background: var(--primary);
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Nav Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-icon {
    position: relative;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 8px;
    transition: var(--transition);
}

.cart-icon:hover { color: var(--primary); }

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.4);
    color: white;
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #d13555; color: white; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--bg-darker) 0%, #0f3460 50%, var(--primary-dark) 100%);
    padding: 100px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(108, 99, 255, 0.15) 0%, transparent 60%);
    animation: float 15s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.highlight { color: var(--primary-light); }

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    background: var(--bg-card);
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
}

.stats-bar .container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item { text-align: center; }

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   SECTIONS
   ============================================ */
.section { padding: 60px 0; }

.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i { color: var(--primary); }
.section-desc { color: var(--text-secondary); margin-bottom: 30px; }

/* ============================================
   EBOOK CARDS & GRID
   ============================================ */
.ebook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.ebook-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.ebook-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.ebook-image {
    position: relative;
    height: 280px;
    overflow: hidden;
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ebook-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ebook-card:hover .ebook-image img { transform: scale(1.05); }

.badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-featured { background: var(--warning); color: #333; }

.ebook-info { padding: 20px; }

.ebook-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.author {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 15px;
}

/* ============================================
   CATEGORIES GRID
   ============================================ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    transition: var(--transition);
    color: var(--text-primary);
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    color: var(--text-primary);
}

.category-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.category-card h3 { font-size: 1rem; margin-bottom: 5px; }
.category-card span { font-size: 0.8rem; color: var(--text-muted); }

/* ============================================
   EBOOK DETAIL
   ============================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 50px;
}

.detail-image {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.detail-image img { width: 100%; height: auto; }

.detail-info h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.price-big {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success);
    margin: 15px 0;
}

.description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 25px;
}

.detail-actions { margin-bottom: 25px; }

.detail-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   AUTH (Login/Register)
   ============================================ */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 450px;
    width: 100%;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: var(--transition);
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2); }

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.alert-error { background: rgba(233, 69, 96, 0.15); border: 1px solid var(--danger); color: var(--danger); }
.alert-success { background: rgba(0, 200, 151, 0.15); border: 1px solid var(--success); color: var(--success); }

/* ============================================
   CART
   ============================================ */
.cart-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.cart-img {
    width: 70px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.cart-item-info { flex: 1; }
.cart-item-info h3 { font-size: 0.95rem; }
.cart-price { font-weight: 700; color: var(--success); font-size: 1.1rem; }

.cart-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    margin-top: 20px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.total-price { color: var(--success); }
.cart-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================
   CHECKOUT
   ============================================ */
.checkout-card {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
}

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

.checkout-total {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 1.2rem;
    color: var(--success);
}

.payment-options {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.payment-option:hover { border-color: var(--primary); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { color: var(--primary); margin-bottom: 20px; }
.empty-state h3 { margin-bottom: 10px; color: var(--text-primary); }
.empty-state .btn { margin-top: 20px; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.page-link {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover, .page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-darker);
    padding: 60px 0 20px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.footer-col p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.7; }

.footer-col ul { list-style: none; }

.footer-col ul li { margin-bottom: 8px; }

.footer-col ul li a {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-col ul li a:hover { color: var(--primary-light); padding-left: 5px; }

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.social-links a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* Newsletter */
.newsletter-form {
    display: flex;
    margin-top: 12px;
}

.newsletter-form input {
    flex: 1;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    font-size: 0.85rem;
}

.newsletter-form button {
    padding: 10px 16px;
    background: var(--primary);
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover { background: var(--primary-dark); }

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.payment-methods {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
}

/* ============================================
   SEARCH COUNT
   ============================================ */
.search-count {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE - Tablet (768px)
   ============================================ */
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        order: 10;
    }

    .nav-menu.active { display: flex; }

    .search-form {
        order: 9;
        max-width: 100%;
        width: 100%;
    }

    .nav-actions .btn-outline,
    .nav-actions .btn-primary { display: none; }

    .navbar { flex-wrap: wrap; }

    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 60px 20px; }

    .detail-grid { grid-template-columns: 1fr; gap: 20px; }
    .detail-info h1 { font-size: 1.5rem; }

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

    .cart-item { flex-wrap: wrap; }

    .stats-bar .container { gap: 15px; }
    .stat-number { font-size: 1.5rem; }

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

    .footer-bottom { flex-direction: column; gap: 10px; text-align: center; }
}

/* ============================================
   RESPONSIVE - Mobile (480px)
   ============================================ */
@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }

    .ebook-grid { grid-template-columns: 1fr; }
    .categories-grid { grid-template-columns: 1fr 1fr; }

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

    .auth-card { padding: 25px; }

    .checkout-card { padding: 20px; }

    .payment-options { flex-direction: column; }

    .cart-actions { flex-direction: column; }
    .cart-actions .btn { width: 100%; }

    .price-big { font-size: 1.5rem; }
    .detail-meta { flex-direction: column; gap: 10px; }
}

/* ============================================
   RESPONSIVE - Large (1024px)
   ============================================ */
@media (min-width: 1024px) {
    .hero h1 { font-size: 3rem; }
}

/* Pagina de Sucesso */
.success-page { text-align: center; padding: 40px 20px; }
.success-icon { font-size: 80px; color: var(--success); margin-bottom: 20px; }
.download-list { list-style: none; padding: 0; margin: 20px 0; border: 1px solid #eee; border-radius: 10px; background: #fafafa; }
.download-list li { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #eee; text-align: left; }
.download-list li:last-child { border-bottom: none; }
.mt-2 { margin-top: 20px; }
