:root {
    --primary: #4E4FEB;
    --secondary: #0E2954;
    --bg: #EDEDFD;
    --font-base: 16px;
    --font-heading: 22px;
    --font-subheading: 18px;
    --font-small: 15px;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 0;
    font-size: var(--font-base);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--secondary);
    font-size: var(--font-heading);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 360px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
    font-size: var(--font-small);
}

.card:hover {
    transform: translateY(-4px);
}

.card-content h3 {
    margin-top: 0;
    font-size: var(--font-subheading);
    color: #333;
}

.card-content p,
.msg-preview {
    font-size: 17px;
    color: #555;
    white-space: pre-line;
}

.msg-preview {
    max-height: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.button-group {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
}

.button-group button {
    flex: 1;
    padding: 12px;
    margin: 5px 4px 0 0;
    font-size: 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: white;
    background-color: var(--primary);
    transition: background 0.3s;
}

.button-group button:last-child {
    margin-right: 0;
}

.button-group button:hover {
    background-color: var(--secondary);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fff;
    margin: 12% auto;
    padding: 24px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    text-align: center;
    font-size: var(--font-base);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--secondary);
    font-size: var(--font-subheading);
}

.modal-content input {
    width: 100%;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: var(--font-base);
}

.modal-content button {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

.modal-content button:hover {
    background: var(--secondary);
}

.close {
    position: absolute;
    top: 8px;
    right: 14px;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
}

.close:hover {
    color: red;
}

@media (max-width: 600px) {
    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
        margin: 5px 0 0 0;
    }

    .modal-content {
        margin-top: 30%;
    }
}
