/* Part two of common.css (the 900-line limit): animations, the template selector and the download buttons.
   index.html loads it directly after common.css, so the cascade order is unchanged. */


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 200% 0; }
}

.animated-element {
    animation: fadeIn 0.8s ease forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

.slide-in {
    animation: slideIn 0.8s ease forwards;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Template buttons */
.template-buttons-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.template-button {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-button:hover {
    background-color: #e9e9e9;
}

.template-button.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Template Selector Styles */
.template-selector-container {
    margin-top: 0px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.template-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    margin-top: 8px;
}

.current-template {
    display: flex;
    align-items: center;
    gap: 15px;
}

#current-template-thumb {
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

#current-template-name {
    font-weight: 600;
    color: var(--text-color);
    padding-right:17px;
}

.btn-change-template {
    background-color: #11678a;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-change-template:hover {
    background-color: var(--primary-hover-color, #005885);
}

.template-options {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

.template-options.active {
    display: grid;
}

.template-option {
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.template-option:hover {
    background-color: rgba(var(--primary-color-rgb), 0.05);
}

.template-option.active {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb), 0.05);
}

.template-option img {
    width: 100%;
    height: 80px;
    object-fit: scale-down;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
}

.template-option-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

/* Dark mode adjustments */
body.dark-mode .template-selector {
    background-color: #333;
    border-color: #444;
}

body.dark-mode #current-template-name,
body.dark-mode .template-option-name {
    color: #eee;
}

body.dark-mode .template-option:hover {
    background-color: #333;
}

body.dark-mode .template-option.active {
    border-color: var(--dark-primary-color);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Download button hover effect */
#global-download-button:hover {
    background-color: #005885 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
    transform: translateY(-2px) !important;
}

#global-download-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* Template-specific download button */
.template-download-button {
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #0077B5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.template-download-button:hover {
    background-color: #005885;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
   .signature {
        padding-left:5px;
        padding-right:5px;
        padding-top:20px;
        padding-bottom:20px;
   }

   .tab {
        padding: 5px !important;
        font-size: 12px;
        margin-right: 15px;
   }
   
   .social-media-platform {
        flex: 0 0 101px;
        padding: 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 10px;
    }
    .social-media-url {
        flex: 1;
        padding: 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        max-width: 31vw;
        font-size: 10px;
    }

    #current-template-thumb {
        height:47px !important;
    }
}