/* ===== VARIABLES & RESET ===== */
:root {
    --primary-color: #0F1B2D;
    --secondary-color: #11C76F;
    --accent-color: #FF7A45;
    --line-color: #00C300;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Thai', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: #f5f7fa;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== HERO SECTION ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a3a5f 100%);
    color: white;
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/pattern-bg.png') center/cover;
    opacity: 0.03;
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hero h1 i {
    color: var(--secondary-color);
    font-size: 2.2rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    box-shadow: var(--shadow-md);
    border-radius: 50px;
    overflow: hidden;
}

.search-form {
    display: flex;
    width: 100%;
}

.search-input-group {
    position: relative;
    flex: 1;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3.5rem;
    border: none;
    font-size: 1.05rem;
    border-radius: 50px 0 0 50px;
    transition: var(--transition);
    border: 2px solid transparent;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(17, 199, 111, 0.25);
}

.search-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0 2rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.search-btn:hover {
    background: #0fa85c;
}

.search-btn i {
    margin-right: 0.5rem;
}

/* ===== FILTERS SECTION ===== */
.filters-section {
    background: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.filters-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-weight: 500;
    color: var(--primary-color);
    white-space: nowrap;
}

.filter-group select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 0.95rem;
    min-width: 180px;
    transition: var(--transition);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(17, 199, 111, 0.1);
}

.filter-actions {
    margin-left: auto;
}

/* ===== MAIN CONTENT ===== */
.downloads-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    font-family: 'Noto Sans Thai', sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.05);
}

/* ===== SECTION HEADER ===== */
.section-header {
    margin: 3rem 0 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.section-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 700;
    position: relative;
    padding-left: 1.5rem;
    line-height: 1.3;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 2.2rem;
    background: var(--secondary-color);
    border-radius: 3px;
    transition: var(--transition);
}

.section-title i {
    color: var(--secondary-color);
    font-size: 1.8rem;
    transition: var(--transition);
}

.section-title:hover::before {
    background: var(--accent-color);
    height: 2.5rem;
}

.section-title:hover i {
    transform: scale(1.1);
}

.section-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== DOWNLOADS GRID ===== */
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0 4rem;
}

@media (max-width: 768px) {
    .downloads-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Download Card */
.download-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.download-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--secondary-color);
    transition: all 0.3s ease;
}

.download-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-color);
}

.download-card:hover::before {
    width: 8px;
    background: var(--accent-color);
}

.download-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.file-icon {
    font-size: 1.5rem;
    color: var(--secondary-color);
    width: 50px;
    height: 50px;
    background: rgba(17, 199, 111, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.download-card:hover .file-icon {
    transform: scale(1.1);
    background: rgba(17, 199, 111, 0.2);
}

.file-header-content {
    flex: 1;
    min-width: 0;
}

.file-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.4;
    transition: color 0.3s ease;
    word-break: break-word;
}

.file-description {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.5rem 0 0 0;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Base file type style */
.file-type {
    display: inline-block;
    font-size: 0.75rem;
    color: #fff;
    background-color: var(--secondary-color);
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.2rem;
    transition: all 0.3s ease;
}

/* Specific file type colors */
.file-type[data-type="manual"],
.file-type[data-type="manuals"],
.file-type[data-type="คู่มือ"] {
    background-color: #3498db; /* Blue for manuals */
}

.file-type[data-type="datasheet"],
.file-type[data-type="datasheets"],
.file-type[data-type="แผ่นข้อมูล"] {
    background-color: #e74c3c; /* Red for datasheets */
}

.file-type[data-type="software"],
.file-type[data-type="ซอฟต์แวร์"] {
    background-color: #9b59b6; /* Purple for software */
}

.file-type[data-type="firmware"],
.file-type[data-type="เฟิร์มแวร์"] {
    background-color: #f39c12; /* Orange for firmware */
}

.file-type[data-type="manual"],
.file-type[data-type="manuals"],
.file-type[data-type="คู่มือ"] {
    background-color: #3498db; /* Blue for manuals */
}

.file-type[data-type="sample"],
.file-type[data-type="samples"],
.file-type[data-type="ตัวอย่าง"] {
    background-color: #1abc9c; /* Teal for samples */
}

.file-type[data-type="update"],
.file-type[data-type="updates"],
.file-type[data-type="อัปเดต"] {
    background-color: #2ecc71; /* Green for updates */
}

.file-type[data-type="driver"],
.file-type[data-type="drivers"],
.file-type[data-type="ไดรเวอร์"] {
    background-color: #e67e22; /* Dark orange for drivers */
}

/* Hover effect for all file types */

.download-card:hover .file-type {
    background-color: var(--accent-color);
    transform: translateY(-1px);
}

.download-card:hover .file-name {
    color: var(--accent-color);
}

.download-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.file-description {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.2rem;
    flex-grow: 1;
}

.file-meta {
    display: flex;
    gap: 1.2rem;
    font-size: 0.85rem;
    color: #666;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.file-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--light-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.file-meta i {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.download-footer {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.download-btn {
    padding: 0.6rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(17, 199, 111, 0.2);
    position: relative;
    overflow: hidden;
}

.download-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: 0.5s;
}

.download-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 122, 69, 0.3);
}

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

.file-date {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-date i {
    color: var(--accent-color);
}

/* Alert */
.alert {
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.alert-info {
    color: #0c5460;
    background-color: #e8f7fa;
    border-color: #b8e7f0;
}

.alert-info::before {
    background: var(--secondary-color);
}

.alert i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
    vertical-align: middle;
}

/* Responsive */
@media (max-width: 1024px) {
    .downloads-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .search-filter {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-box,
    .category-filter {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .downloads-container {
        padding: 1.5rem 1rem;
    }
    
    .downloads-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .file-meta {
        gap: 0.8rem;
    }
    
    .file-meta-item {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }
    
    .download-btn {
        padding: 0.5rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Search and Filter */
.search-filter {
    margin: 2.5rem 0;
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    align-items: center;
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1.2rem 0.8rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(17, 199, 111, 0.1);
}

.search-box i {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.category-filter {
    min-width: 220px;
    position: relative;
}

.category-filter select {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2311C76F' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-filter select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(17, 199, 111, 0.1);
}

.category-filter select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    color: #333;
}

/* Popular Downloads */
.popular-downloads {
    margin-top: 40px;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

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

.category-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.category-icon {
    font-size: 32px;
    color: #007bff;
    margin-bottom: 10px;
}

.category-info h3 {
    margin: 0 0 5px;
    font-size: 16px;
}

.category-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}