@import url('variables.css');

/* Color Variables */
:root {
    --machinery-primary: var(--primary);
    --machinery-secondary: var(--dark);
    --machinery-accent: var(--accent);
    --machinery-light: var(--light-gray);
    --machinery-success: var(--success);
    --machinery-warning: var(--warning);
    --machinery-danger: var(--danger);
}

/* Header Styles */
.machinery-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.machinery-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.machinery-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/img/pattern.png') repeat;
    opacity: 0.1;
    pointer-events: none;
}

.machinery-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.back-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: inline-block;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 1.5rem;
}

.back-link::before {
    content: '←';
    position: absolute;
    left: 0;
    transition: transform 0.3s ease;
}

.back-link:hover {
    color: white;
    transform: translateX(-5px);
}

.back-link:hover::before {
    transform: translateX(-5px);
}

/* Section Styles */
.machinery-section {
    padding: 3rem 0;
    background: var(--machinery-light);
}

.machinery-section:nth-child(even) {
    background: white;
}

.section-title {
    text-align: center;
    color: var(--machinery-primary);
    margin-bottom: 1rem;
    font-size: 2rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--machinery-accent);
    border-radius: 2px;
}

.section-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Grid Layout */
.machinery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Machine Card */
.machine-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    position: relative;
}

.machine-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.machine-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(45deg, var(--machinery-primary), var(--machinery-secondary));
}

.machine-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.machine-card:hover .machine-image img {
    transform: scale(1.05);
}

.machine-content {
    padding: 1.5rem;
}

.machine-title {
    font-size: 1.2rem;
    color: var(--machinery-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.4;
}

.machine-description {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-lineclamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.machine-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--machinery-accent);
    margin-bottom: 0.5rem;
}

.machine-price::before {
    content: '₦';
    font-size: 1rem;
    vertical-align: top;
}

/* Specifications */
.machine-specs {
    list-style-type: none;
    padding: 0;
    margin: 1rem 0;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.machine-specs li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0;
    padding: 0.25rem 0;
    border-bottom: 1px dashed #eee;
}

.machine-specs li:last-child {
    border-bottom: none;
}

.spec-label {
    font-weight: 600;
    color: var(--machinery-primary);
    font-size: 0.9rem;
}

.spec-value {
    color: #666;
    font-size: 0.9rem;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

/* Machine Card */
.machine-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--light-gray);
}

.machine-title {
    color: var(--primary);
}

.machine-price {
    color: var(--accent);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent);
}

.machine-tag {
    background: var(--warning);
}

.machine-tag.imported {
    background: var(--accent);
}

.machine-tag.local {
    background: var(--success);
}

/* Actions */
.machine-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.btn-primary {
    background: var(--machinery-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--machinery-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    flex: 1;
    font-size: 0.95rem;
}

.btn-whatsapp:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:active {
    transform: translateY(0);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.search-box input:focus {
    outline: none;
    border-color: var(--machinery-accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    pointer-events: none;
}

.category-filter {
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 1rem;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-filter:focus {
    outline: none;
    border-color: var(--machinery-accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Product Count */
.product-count {
    text-align: center;
    margin: 1rem 0;
    color: #666;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
}

/* Machine Type Sections */
.machine-type-section {
    margin-bottom: 3rem;
}

.machine-type-title {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--machinery-primary);
    color: var(--machinery-primary);
    font-size: 1.8rem;
    position: relative;
}

.machine-type-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--machinery-accent);
}

/* Contact Options */
.contact-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.contact-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--machinery-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 200px;
}

.contact-btn:hover {
    background-color: var(--machinery-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.contact-btn.whatsapp {
    background-color: #25D366;
}

.contact-btn.whatsapp:hover {
    background-color: #128C7E;
}

/* Load More Button */
#load-more {
    margin: 2rem auto 0;
    display: block;
    min-width: 200px;
}

/* Stock Badge */
.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--machinery-success);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

.stock-badge.low-stock {
    background: var(--machinery-warning);
}

.stock-badge.out-of-stock {
    background: var(--machinery-danger);
}

/* Responsive Design */
@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        padding: 1rem;
    }
    
    .search-box, .category-filter {
        min-width: 100%;
        max-width: 100%;
    }
    
    .machinery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .machinery-header {
        padding: 2rem 0;
    }
    
    .machinery-header h1 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .machine-actions {
        flex-direction: column;
    }
    
    .contact-options {
        flex-direction: column;
        align-items: center;
    }
    
    .contact-btn {
        width: 100%;
        min-width: unset;
    }
    
    .machine-type-title {
        font-size: 1.5rem;
    }
    
    .machine-content {
        padding: 1rem;
    }
    
    .machine-title {
        font-size: 1.1rem;
    }
    
    .machine-price {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .machine-specs li {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .spec-value {
        margin-top: 0.25rem;
        text-align: left;
        max-width: 100%;
    }
    
    .machine-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
}

/* Animation for new items */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.machine-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

/* Cart notification animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.cart-notification {
    animation: slideInRight 0.3s ease;
}

.cart-notification.hiding {
    animation: slideOutRight 0.3s ease;
}
