/* Card Generator Frontend Styles */

.card-generator-frontend {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
    position: relative;
}

/* Header Section */
.card-generator-header-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card-generator-header-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="sparkles" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="5" cy="5" r="1" fill="white" opacity="0.3"/><circle cx="15" cy="15" r="0.5" fill="white" opacity="0.2"/><circle cx="10" cy="2" r="0.5" fill="white" opacity="0.4"/><circle cx="2" cy="12" r="0.8" fill="white" opacity="0.2"/><circle cx="18" cy="8" r="0.3" fill="white" opacity="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23sparkles)"/></svg>');
    pointer-events: none;
}

.card-generator-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    position: relative;
    z-index: 1;
}

.title-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.card-generator-subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Container */
.card-generator-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Main Content */
.card-generator-content-front {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    background: white;
}

/* Left Column */
.card-generator-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.card-customization {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.card-customization:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-customization h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-customization h3::before {
    content: '✨';
    font-size: 1.25rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-group input[type="text"]::placeholder {
    color: #a0aec0;
    opacity: 1;
}

.input-helper {
    font-size: 0.875rem;
    color: #718096;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.input-helper::before {
    content: '💡';
    font-size: 0.875rem;
}

/* Generate Button */
.generate-button {
    width: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1.25rem 2rem;
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.generate-button::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: left 0.5s;
}

.generate-button:hover::before {
    left: 100%;
}

.generate-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.generate-button:active {
    transform: translateY(-1px);
}

.generate-button:disabled {
    opacity: 0.7;
    transform: none;
    cursor: not-allowed;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.button-icon {
    font-size: 1.25rem;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

.button-loading {
    display: none;
    align-items: center;
    gap: 0.75rem;
}

/* Text Customization */
.text-customization {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e2e8f0;
}

.text-customization h4 {
    margin: 0 0 1.25rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-customization h4::before {
    content: '🎨';
    font-size: 1rem;
}

.style-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-group-front {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.control-group-front:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.control-group-front label {
    font-weight: 600;
    color: #4a5568;
    margin: 0;
    font-size: 0.95rem;
}

.font-size-controls-front {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.size-btn-front {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: white;
    color: #4a5568;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.size-btn-front:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.size-btn-front:active {
    transform: scale(0.95);
}

#fontSizeDisplay {
    font-weight: bold;
    min-width: 3rem;
    text-align: center;
    color: #2d3748;
    font-size: 1.1rem;
    background: #f7fafc;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

input[type="color"] {
    -webkit-appearance: none;
    width: 50px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

input[type="color"]:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 8px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.color-preview-front {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.color-preview-front:hover {
    transform: scale(1.1);
}

select {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4a5568;
    min-width: 140px;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select:hover {
    border-color: #cbd5e0;
}

/* Card Preview Section */
.card-preview-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    text-align: center;
    position: relative;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.card-preview-section:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.loading-spinner-front {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: #718096;
}

.loading-spinner-front p {
    font-weight: 500;
    font-size: 1rem;
}

.spinner-front {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-radius: 50%;
    border-top: 4px solid #667eea;
    animation: spin 1s linear infinite;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message-front {
    color: #e53e3e;
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    border-radius: 12px;
    border: 2px solid #feb2b2;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.card-canvas {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    margin: 1rem 0;
    transition: all 0.3s ease;
    border: 3px solid #f7fafc;
}

.card-canvas:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.download-button {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
    position: relative;
    overflow: hidden;
}

.download-button::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: left 0.5s;
}

.download-button:hover::before {
    left: 100%;
}

.download-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
    text-decoration: none;
    color: white;
}

.download-button:active {
    transform: translateY(-1px);
}

.download-icon {
    font-size: 1.25rem;
    animation: bounce-download 2s infinite;
}

@keyframes bounce-download {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-1px); }
}

/* Right Column */
.card-generator-right {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.card-generator-right:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-generator-right h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-generator-right h3::before {
    content: '🖼️';
    font-size: 1.25rem;
}

/* Category Filters */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.category-btn {
    padding: 0.6rem 1.25rem;
    border: 2px solid #e2e8f0;
    background: white;
    color: #4a5568;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.category-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.category-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.category-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Templates Grid */
.templates-grid-front {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.25rem;
    max-height: 550px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.templates-grid-front::-webkit-scrollbar {
    width: 8px;
}

.templates-grid-front::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.templates-grid-front::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #cbd5e0, #a0aec0);
    border-radius: 4px;
}

.templates-grid-front::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a0aec0, #718096);
}

.templates-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem 1rem;
    color: #718096;
}

.templates-loading p {
    font-weight: 500;
    font-size: 1.1rem;
}

.template-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.template-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.template-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.template-item.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transform: translateY(-4px);
}

.template-item.selected::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
    z-index: 10;
}

.template-image-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.template-item:hover img {
    transform: scale(1.08);
}

.template-overlay-front {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-item.selected .template-overlay-front {
    opacity: 1;
}

.template-item:hover .template-overlay-front {
    opacity: 0.8;
}

.select-icon {
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    animation: checkmark 0.5s ease;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.template-info-front {
    padding: 1rem;
}

.template-info-front h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.3;
}

.template-category {
    font-size: 0.75rem;
    color: #718096;
    background: #edf2f7;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* No Templates State */
.no-templates-front {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: #718096;
}

.no-templates-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.no-templates-front h4 {
    font-size: 1.5rem;
    margin: 0 0 0.75rem 0;
    color: #4a5568;
    font-weight: 600;
}

.no-templates-front p {
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* Messages */
.card-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 1.25rem 1.75rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 380px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}

.card-message.show {
    transform: translateX(0);
}

.card-message:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.card-message-success {
    border-left: 4px solid #48bb78;
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
}

.card-message-error {
    border-left: 4px solid #e53e3e;
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
}

.card-message-info {
    border-left: 4px solid #4299e1;
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
}

.card-message-warning {
    border-left: 4px solid #ed8936;
    background: linear-gradient(135deg, #fefcbf, #faf089);
}

.message-icon {
    font-size: 1.5rem;
    animation: messageIcon 0.5s ease;
}

@keyframes messageIcon {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.message-text {
    font-weight: 500;
    color: #2d3748;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Theme Variations */
.card-generator-frontend.theme-dark {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #e2e8f0;
}

.theme-dark .card-generator-content-front,
.theme-dark .card-customization,
.theme-dark .card-preview-section,
.theme-dark .card-generator-right,
.theme-dark .template-item,
.theme-dark .control-group-front {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.theme-dark .card-customization h3,
.theme-dark .card-generator-right h3,
.theme-dark .template-info-front h5 {
    color: #e2e8f0;
}

.theme-dark .input-group input[type="text"],
.theme-dark select {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

.theme-dark .category-btn {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.theme-minimal .card-generator-frontend {
    background: white;
    box-shadow: none;
    border: 1px solid #e2e8f0;
}

.theme-minimal .card-generator-header-front {
    background: #f8fafc;
    color: #2d3748;
}

.theme-colorful .card-generator-header-front {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 300% 300%;
    animation: colorful-gradient 8s ease infinite;
}

@keyframes colorful-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .card-generator-content-front {
        gap: 1.5rem;
    }
    
    .templates-grid-front {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (max-width: 768px) {
    .card-generator-content-front {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .card-generator-header-front {
        padding: 2rem 1.5rem;
    }
    
    .card-generator-title {
        font-size: 2rem;
    }
    
    .category-filters {
        justify-content: center;
    }
    
    .templates-grid-front {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        max-height: 350px;
        gap: 1rem;
    }
    
    .style-controls {
        gap: 1rem;
    }
    
    .control-group-front {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .font-size-controls-front,
    .color-picker-wrapper {
        align-self: flex-end;
    }
    
    .card-message {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .card-customization,
    .card-preview-section,
    .card-generator-right {
        padding: 1.25rem;
    }
    
    .generate-button {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .card-generator-frontend {
        margin: 1rem 0;
        border-radius: 12px;
    }
    
    .card-generator-header-front {
        padding: 1.5rem 1rem;
    }
    
    .card-generator-title {
        font-size: 1.75rem;
    }
    
    .card-generator-content-front {
        padding: 1rem;
    }
    
    .templates-grid-front {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .card-customization,
    .card-preview-section,
    .card-generator-right {
        padding: 1rem;
    }
    
    .style-controls {
        gap: 0.75rem;
    }
    
    .size-btn-front {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
    
    .input-group input[type="text"] {
        padding: 0.875rem 1rem;
    }
    
    .category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .template-info-front {
        padding: 0.75rem;
    }
    
    .template-info-front h5 {
        font-size: 0.8rem;
    }
    
    .template-category {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
}

/* Animation for template loading */
.template-item {
    animation: fadeInUp 0.6s ease forwards;
}

.template-item:nth-child(1) { animation-delay: 0.1s; }
.template-item:nth-child(2) { animation-delay: 0.15s; }
.template-item:nth-child(3) { animation-delay: 0.2s; }
.template-item:nth-child(4) { animation-delay: 0.25s; }
.template-item:nth-child(5) { animation-delay: 0.3s; }
.template-item:nth-child(6) { animation-delay: 0.35s; }
.template-item:nth-child(7) { animation-delay: 0.4s; }
.template-item:nth-child(8) { animation-delay: 0.45s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card-generator-frontend {
        border: 2px solid #000;
    }
    
    .generate-button,
    .download-button {
        border: 2px solid #000;
    }
    
    .template-item {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .template-item:hover {
        transform: none;
    }
    
    .generate-button:hover,
    .download-button:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .card-generator-frontend {
        background: white;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .card-generator-header-front {
        background: white;
        color: #000;
    }
    
    .card-generator-right,
    .text-customization,
    .generate-button,
    .download-button,
    .category-filters {
        display: none;
    }
    
    .card-generator-content-front {
        grid-template-columns: 1fr;
    }
    
    .card-canvas {
        max-width: 100%;
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Focus states for accessibility */
.template-item:focus,
.generate-button:focus,
.download-button:focus,
.category-btn:focus,
.size-btn-front:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Custom scrollbar for webkit browsers */
.templates-grid-front {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f1f5f9;
}

/* Loading skeleton animation */
.template-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Advanced button effects */
.generate-button,
.download-button {
    position: relative;
    overflow: hidden;
}

.generate-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.generate-button:active::after {
    width: 300px;
    height: 300px;
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}