@import url('base.css');

.template-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px var(--space-lg) var(--space-xxl);
}

.template-container h1 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    text-align: center;
}

.template-container .subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    max-width: 700px;
    margin: 0 auto var(--space-xl);
    line-height: 1.5;
}

.template-category {
    margin-bottom: var(--space-xxl);
}

.category-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.category-header h2 {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.category-header p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: all var(--transition-normal);
}

.template-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-3px);
}

.template-card h3 {
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

.template-card p {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
    font-size: var(--text-xs);
}

.template-features {
    list-style: none;
    margin-bottom: var(--space-md);
}

.template-features li {
    padding: var(--space-xs) 0;
    position: relative;
    padding-left: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.template-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-blue);
    font-weight: bold;
}

.download-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.btn-download,
.btn-preview {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
}

.btn-download {
    background: var(--primary-blue);
    color: var(--text-primary);
    border: 2px solid var(--primary-blue);
}

.btn-download:hover {
    background: var(--primary-blue-dark);
    border-color: var(--primary-blue-dark);
    transform: translateY(-1px);
}

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

.btn-preview:hover {
    background: rgba(0, 150, 255, 0.1);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.btn-download:disabled,
.btn-preview:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.usage-tips {
    background: var(--bg-card);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border-left: 4px solid var(--primary-blue);
    margin-top: var(--space-xl);
}

.usage-tips h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-size: var(--text-base);
    font-weight: 600;
}

.usage-tips ul {
    list-style: none;
}

.usage-tips li {
    padding: var(--space-xs) 0;
    position: relative;
    padding-left: var(--space-md);
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: var(--text-xs);
}

.usage-tips li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-blue);
    font-weight: bold;
}

.usage-tips strong {
    color: var(--primary-blue);
    font-weight: 600;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-normal);
    backdrop-filter: blur(20px);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    background: var(--primary-blue);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 600;
}

.close {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-normal);
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.template-preview {
    padding: var(--space-lg);
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-secondary);
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
}

.template-preview::-webkit-scrollbar {
    width: 8px;
}

.template-preview::-webkit-scrollbar-track {
    background: var(--border-subtle);
    border-radius: 4px;
}

.template-preview::-webkit-scrollbar-thumb {
    background: var(--border-normal);
    border-radius: 4px;
}

.template-preview::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-normal);
    border-radius: 50%;
    border-top-color: var(--primary-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .template-container {
        padding: 100px var(--space-sm) var(--space-lg);
    }
    
    .template-container h1 {
        font-size: 1.8rem;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .template-card {
        padding: var(--space-md);
    }
    
    .download-actions {
        flex-direction: column;
    }
    
    .btn-download,
    .btn-preview {
        width: 100%;
        justify-content: center;
    }
    
    .usage-tips {
        padding: var(--space-md);
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .template-preview {
        padding: var(--space-md);
        font-size: var(--text-xs);
    }
}

@media (max-width: 480px) {
    .template-container {
        padding: 90px var(--space-xs) var(--space-md);
    }
    
    .template-container h1 {
        font-size: 1.6rem;
    }
    
    .category-header h2 {
        font-size: var(--text-lg);
    }
    
    .template-card {
        padding: var(--space-sm);
    }
    
    .modal-header {
        padding: var(--space-sm) var(--space-md);
    }
    
    .template-preview {
        padding: var(--space-sm);
    }
}