:root {
    --ct-primary: #CC0000;
    --ct-dark: #1a1a1a;
    --ct-light: #f8f9fa;
    --ct-border: #e0e0e0;
    --ct-glass: rgba(255, 255, 255, 0.8);
    --ct-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.chieftek-download-container {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ct-dark);
    max-width: 1400px;
    margin: 2rem auto;
    width: 95%;
}

/* Tabs */
.ct-tabs-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--ct-border);
    padding-bottom: 0.5rem;
}

.ct-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
}

.ct-tab-btn.active {
    color: var(--ct-primary);
}

.ct-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--ct-primary);
}

/* Search */
.ct-search-box {
    margin-bottom: 2rem;
    position: relative;
}

.ct-search-box input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 1px solid var(--ct-border);
    border-radius: 50px;
    background: var(--ct-glass);
    backdrop-filter: blur(10px);
    box-shadow: var(--ct-shadow);
    outline: none;
    transition: all 0.3s ease;
}

.ct-search-box input:focus {
    border-color: var(--ct-primary);
    box-shadow: 0 0 0 4px rgba(204, 0, 0, 0.1);
}

/* Grid */
.ct-download-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .ct-download-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .ct-download-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ct-download-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .ct-download-grid {
        grid-template-columns: 1fr;
    }
}

.ct-category-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--ct-border);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ct-card-image {
    padding: 1rem;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
}

.ct-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.ct-category-card:hover .ct-card-image img {
    transform: scale(1.1);
}

.ct-category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--ct-shadow);
}

.ct-card-header {
    background: var(--ct-section-custom-color, var(--ct-card-header-bg, var(--ct-primary)));
    color: white;
    padding: 1rem;
    font-weight: 700;
    font-size: var(--ct-card-header-size, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ct-file-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.ct-file-item {
    border-bottom: 1px solid var(--ct-border);
}

.ct-file-item:last-child {
    border-bottom: none;
}

.ct-file-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none !important;
    color: var(--ct-dark);
    transition: background 0.3s ease;
}

.ct-file-link:hover {
    background: #fff5f5;
    color: var(--ct-primary);
}

.ct-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    opacity: 0.7;
}

.ct-group-separator {
    grid-column: 1 / -1;
    height: 1px;
    background: transparent;
    margin: 4rem 0 2rem 0;
    position: relative;
    width: 100%;
    clear: both;
}

.ct-category-card.hidden {
    display: none;
}

/* Member System UI */
.ct-user-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: #ffffff;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.ct-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 14px;
}

.ct-username-display {
    font-weight: 600;
    color: #333;
}

.ct-logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    color: #CC0000;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    border: 1px solid #eee;
}

.ct-logout-btn:hover {
    background: #CC0000;
    color: white;
    border-color: #CC0000;
}

.ct-file-locked {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #999;
    cursor: default;
    background: #fdfdfd;
}

.ct-file-locked .ct-icon {
    color: #ccc;
}

/* --- LOGIN SCREEN V2 --- */
.ct-login-screen-v2 {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    /* 減少電腦版上方留白 */
    background: #fdfdfd;
    min-height: 50vh;
}

.ct-login-card {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 480px;
    padding: 40px;
    text-align: center;
}

.ct-login-header {
    margin-bottom: 30px;
}

.ct-lock-icon {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #CC0000;
    margin: 0 auto 15px auto;
    display: block;
}

.ct-login-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.ct-login-header p {
    color: #666;
    font-size: 15px;
    line-height: 1.5;
}

.ct-login-error-msg {
    background: #fff5f5;
    border-left: 4px solid #CC0000;
    color: #CC0000;
    padding: 12px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 14px;
    border-radius: 4px;
}

#ct-login-form-custom p {
    text-align: left;
    margin-bottom: 15px;
}

#ct-login-form-custom label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
}

#ct-login-form-custom input[type="text"],
#ct-login-form-custom input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

#ct-login-form-custom input:focus {
    border-color: #CC0000;
    outline: none;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);
}

#ct-login-form-custom .login-submit {
    margin-top: 20px;
}

#ct-login-form-custom input[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #CC0000 0%, #a00000 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#ct-login-form-custom input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(204, 0, 0, 0.2);
}

.ct-login-footer {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #eee;
    font-size: 15px;
}

.ct-reg-link {
    color: #CC0000;
    text-decoration: none;
    font-weight: 700;
    margin-left: 8px;
}

.ct-reg-link:hover {
    text-decoration: underline;
}

/* 響應式調整：手機版減少左右留白 */
@media (max-width: 768px) {
    .ct-login-screen-v2 {
        padding: 20px 0; /* Remove side padding from container */
    }

    .ct-login-card {
        width: 90%; /* 90% width = 5% margin on each side */
        margin: 0 auto;
        padding: 30px 20px;
        border-radius: 12px;
    }

    .ct-login-header h2 {
        font-size: 22px;
    }
}