/* ========== TEMPLATE SELECTOR MODAL ========== */
.template-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.template-modal.show {
    display: flex;
}

.template-modal-content {
    background: #faf8f5;
    border-radius: 16px;
    padding: 32px;
    max-width: 1100px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.template-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(107, 142, 127, 0.2);
}

.template-modal-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    font-weight: 600;
    color: #5d4a36;
    letter-spacing: 2px;
    margin: 0;
}

.template-close {
    background: transparent;
    border: none;
    font-size: 32px;
    color: #5d4a36;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.template-close:hover {
    background: rgba(107, 142, 127, 0.1);
    transform: rotate(90deg);
}

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

.template-card {
    background: white;
    border: 2px solid rgba(107, 142, 127, 0.2);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.template-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(107, 142, 127, 0.2);
}

.template-card:hover::before {
    transform: scaleX(1);
}

.template-color-preview {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.template-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 600;
    color: #5d4a36;
    margin: 0 0 8px 0;
    letter-spacing: 1px;
}

.template-card p {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    color: var(--accent-color);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.template-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.template-meta span {
    font-family: 'Cormorant Garamond', serif;
    font-size: 12px;
    color: #5d4a36;
    background: rgba(107, 142, 127, 0.08);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .template-modal-content {
        padding: 20px;
        max-height: 90vh;
    }
    
    .template-modal-header h2 {
        font-size: 22px;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .template-card {
        padding: 16px;
    }
}

/* Button for templates */
.btn-templates {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 20px;
    z-index: 9999;
    background: linear-gradient(135deg, #6b8e7f 0%, #567368 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 1.5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-templates:hover {
    background: linear-gradient(135deg, #567368 0%, #6b8e7f 100%);
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.5);
}

.btn-templates svg {
    width: 18px;
    height: 18px;
    fill: white;
}

@media (max-width: 768px) {
    .btn-templates {
        display: none;
    }
}
