/* CSS Reset for production consistency */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table, caption,
tbody, tfoot, thead, tr, th, td, article,
aside, canvas, details, embed, figure,
figcaption, footer, header, hgroup, menu,
nav, output, ruby, section, summary, time,
mark, audio, video {
    margin: 0; padding: 0; border: 0;
    font-size: 100%; font: inherit; vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}
body { line-height: 1; }
ol, ul { list-style: none; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after { content: ''; content: none; }
table { border-collapse: collapse; border-spacing: 0; }

/* Focus style for accessibility */
:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Visually hidden class for accessibility */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

header {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 30px 0;
    text-align: center;
    border-bottom: 5px solid #3498db;
}

header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5em;
    font-weight: 600;
}

header p {
    font-size: 1.1em;
    margin-bottom: 20px;
}

.data-url-section {
    margin-top: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    display: inline-block;
}

.data-url-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #bdc3c7;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group input[type="url"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #7f8c8d;
    border-radius: 5px;
    font-size: 1em;
    background-color: #ecf0f1;
    color: #2c3e50;
    min-width: 300px;
}

.input-group input[type="url"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.input-group button {
    padding: 12px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group button:hover {
    background-color: #2980b9;
}

.input-group button i {
    font-size: 0.9em;
}

.save-status {
    margin-top: 10px;
    font-size: 0.9em;
    color: #e67e22; /* Default to a warning/info color */
    min-height: 1.2em; /* Reserve space to prevent layout shifts */
}

.save-status.success {
    color: #2ecc71; /* Green for success */
}

.save-status.error {
    color: #e74c3c; /* Red for error */
}


main {
    padding: 20px 0;
}

.filter-section {
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-section input[type="text"],
.filter-section select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
    background-color: #fff;
}

.filter-section input[type="text"] {
    flex-grow: 1;
    min-width: 250px;
}

.filter-section select {
    min-width: 150px;
    cursor: pointer;
}


.templates-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.template-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.template-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #e0e0e0;
}

.template-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.template-card-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.4em;
    color: #2c3e50;
}

.template-card-content .category-badge {
    display: inline-block;
    background-color: #e0e0e0;
    color: #555;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-bottom: 10px;
}

.template-card-content .premium-badge {
    display: inline-block;
    background-color: #f1c40f; /* Gold for premium */
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.template-card-content p {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
    flex-grow: 1;
}

.template-tags {
    margin-bottom: 15px;
}

.tag {
    display: inline-block;
    background-color: #ecf0f1;
    color: #7f8c8d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-right: 5px;
    margin-bottom: 5px;
}

.template-card-actions {
    margin-top: auto; /* Pushes actions to the bottom */
}

.template-card-actions .btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.template-card-actions .btn:hover {
    background-color: #2980b9;
}

.template-card-actions .btn i {
    margin-right: 8px;
}


footer {
    background-color: #1c2833;
    color: #aab8c2;
    text-align: center;
    padding: 25px 0;
    margin-top: 40px;
    font-size: 0.9em;
}

footer p {
    margin: 5px 0;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .input-group input[type="url"] {
        min-width: auto;
        margin-bottom: 10px;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-section input[type="text"],
    .filter-section select {
        width: 100%;
        margin-bottom: 10px;
    }
    .filter-section input[type="text"]:last-child,
    .filter-section select:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2em;
    }
    .template-card-content h3 {
        font-size: 1.2em;
    }
}
