/* ========================================
   Krisenkommunikation Tool - Modern Design
   Inspiriert von Google Material 3 & Apple HIG
   ======================================== */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #c62828;
    --color-primary-dark: #b71c1c;
    --color-primary-light: #ffebee;
    --color-primary-container: #ffdad6;
    --color-secondary: #1a73e8;
    --color-secondary-dark: #1557b0;
    --color-secondary-light: #e8f0fe;
    --color-dark: #1d1b20;
    --color-on-surface: #1d1b20;
    --color-on-surface-variant: #49454f;
    --color-gray: #79747e;
    --color-gray-light: #e7e0ec;
    --color-gray-lighter: #f7f2fa;
    --color-outline: #cac4d0;
    --color-outline-variant: #e7e0ec;
    --color-white: #ffffff;
    --color-surface: #fffbfe;
    --color-surface-dim: #ded8e1;
    --color-surface-container: #f3edf7;
    --color-surface-container-low: #f7f2fa;
    --color-surface-container-high: #ece6f0;
    --color-success: #1b873a;
    --color-success-light: #dcfce7;
    --color-warning: #e8a317;
    --color-warning-light: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-light: #fee2e2;
    --color-info: #0b84a5;
    --color-info-light: #e0f2fe;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-elevated: 0 8px 30px rgba(0, 0, 0, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    --border-radius: 12px;

    --transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    --transition-slow: all 0.35s cubic-bezier(0.2, 0, 0, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
                 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-on-surface);
    background: var(--color-surface);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Container === */
.container {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === Header === */
.header {
    background: var(--color-white);
    color: var(--color-on-surface);
    padding: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--color-outline-variant);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 251, 254, 0.88);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 64px;
    justify-content: center;
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-on-surface);
    letter-spacing: -0.01em;
    padding: 16px 0;
}

.logo h1 i {
    font-size: 22px;
    color: var(--color-primary);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding-bottom: 8px;
}

.nav-link {
    color: var(--color-on-surface-variant) !important;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.nav-link-button {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.nav-link:hover {
    background: var(--color-surface-container-high) !important;
    color: var(--color-on-surface) !important;
}

.nav-link.active {
    background: var(--color-primary-container) !important;
    color: var(--color-primary-dark) !important;
    font-weight: 600;
}

.user-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    font-size: 14px;
}

.user-name {
    font-weight: 600;
    color: var(--color-on-surface);
}

.user-role {
    background: var(--color-surface-container-high);
    color: var(--color-on-surface-variant);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

/* === Main Content === */
.main-content {
    padding: 24px 0 40px;
    min-height: calc(100vh - 120px);
    background: linear-gradient(135deg, #dc3545 0%, #212529 100%);
}

/* === Alerts === */
.alert {
    padding: 14px 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.alert-warning {
    background: var(--color-warning-light);
    color: #92400e;
}

.alert-info {
    background: var(--color-info-light);
    color: #0c4a6e;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.15s ease;
    border-radius: inherit;
}

.btn:hover::after {
    opacity: 0.08;
}

.btn:active::after {
    opacity: 0.12;
}

.btn i {
    font-size: 14px;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    transform: none;
}

.btn-secondary {
    background: var(--color-secondary);
    color: var(--color-white);
    border-color: transparent;
}

.btn-secondary:hover {
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--color-on-surface-variant);
    border: 1px solid var(--color-outline);
}

.btn-outline:hover {
    background: var(--color-surface-container-low);
    border-color: var(--color-on-surface-variant);
}

.btn-success {
    background: var(--color-success);
    color: var(--color-white);
    border: none;
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
    border: none;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

/* === Cards === */
.card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: none;
    border: 1px solid var(--color-outline-variant);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    background: var(--color-white);
    color: var(--color-on-surface);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--color-outline-variant);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 24px;
}

/* === Filter Section === */
.filter-section {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-outline-variant);
    box-shadow: none;
    padding: 24px;
    margin-bottom: 24px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-on-surface);
    margin: 0;
    letter-spacing: -0.01em;
}

.filter-form {
    margin-top: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.filter-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-on-surface-variant);
    letter-spacing: 0.02em;
}

.filter-item input[type="text"],
.filter-item select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-outline);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--color-white);
    color: var(--color-on-surface);
    -webkit-appearance: none;
}

.filter-item input[type="text"]:focus,
.filter-item select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 24px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-secondary);
    border-radius: 4px;
}

.full-width {
    grid-column: 1 / -1;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* === Results Header === */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.results-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-white);
    margin: 0;
    letter-spacing: -0.02em;
}

/* === Results Header Actions === */
.results-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* === View Toggle === */
.view-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    border: none;
    padding: 4px;
    overflow: visible;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    line-height: 1;
    border-radius: var(--radius-full);
}

.view-toggle-btn:not(:last-child) {
    border-right: none;
}

.view-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

.view-toggle-btn.active {
    background: var(--color-white);
    color: var(--color-on-surface);
    box-shadow: var(--shadow-md);
}

/* === Templates List View === */
.templates-list-table-wrap {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-outline-variant);
    box-shadow: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.templates-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 1100px;
}

.templates-list-table thead {
    background: var(--color-surface-container-low);
}

.templates-list-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: var(--color-on-surface-variant);
    white-space: nowrap;
    border-bottom: 1px solid var(--color-outline-variant);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.templates-list-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-outline-variant);
    vertical-align: middle;
}

.templates-list-table tbody tr {
    transition: var(--transition);
}

.templates-list-table tbody tr:hover {
    background: var(--color-surface-container-low);
}

.templates-list-table .col-fav {
    width: 40px;
    text-align: center;
    padding: 12px 8px;
}

.templates-list-table .col-title a {
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 600;
}

.templates-list-table .col-title a:hover {
    text-decoration: underline;
}

.templates-list-table .col-date {
    white-space: nowrap;
    color: var(--color-gray);
    font-size: 13px;
}

.templates-list-table .col-actions {
    white-space: nowrap;
}

.templates-list-table .col-actions .btn {
    padding: 5px 10px;
}

.btn-favorite-sm {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--color-gray);
    transition: var(--transition);
    padding: 4px;
    line-height: 1;
}

.btn-favorite-sm:hover {
    color: var(--color-warning);
}

.btn-favorite-sm.active {
    color: var(--color-warning);
}

/* === Templates Grid === */
.templates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.template-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-outline-variant);
    box-shadow: none;
    padding: 24px;
    transition: var(--transition);
}

.template-card:hover {
    border-color: var(--color-outline);
    box-shadow: var(--shadow-lg);
    transform: none;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.template-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-on-surface);
    margin: 0;
    flex: 1;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.btn-favorite {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    color: var(--color-gray);
}

.btn-favorite:hover {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border-color: transparent;
}

.btn-favorite.active {
    background: var(--color-warning-light);
    border-color: transparent;
    color: var(--color-warning);
    transform: none;
}

.btn-favorite i {
    display: block;
}

.template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.badge-krisenkommunikation {
    background: #fff7ed;
    color: #9a3412;
}

.badge-risikokommunikation {
    background: #eff6ff;
    color: #1e40af;
}

.badge-pressemitteilung {
    background: #ecfdf5;
    color: #065f46;
}

.badge-social_media {
    background: #f5f3ff;
    color: #5b21b6;
}

.badge-interne_meldung {
    background: #fdf2f8;
    color: #9d174d;
}

.badge-buergerinformation {
    background: #f0fdf4;
    color: #166534;
}

.badge-warnmeldung {
    background: #fffbeb;
    color: #92400e;
}

.badge-alert-information {
    background: var(--color-info-light);
    color: #0c4a6e;
}

.badge-alert-warnung {
    background: var(--color-warning-light);
    color: #92400e;
}

.badge-alert-alarmierung {
    background: #fee2e2;
    color: #991b1b;
}

.badge-alert-katastrophenalarm {
    background: var(--color-danger);
    color: white;
    font-weight: 600;
}

.badge-status-entwurf {
    background: var(--color-surface-container-high);
    color: var(--color-on-surface-variant);
}

.badge-status-freigegeben {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-status-archiviert {
    background: #fef2f2;
    color: #991b1b;
}

.badge-admin {
    background: var(--color-danger);
    color: white;
}

.badge-redakteur {
    background: var(--color-secondary);
    color: white;
}

.badge-autor {
    background: var(--color-success);
    color: white;
}

.badge-leser {
    background: var(--color-gray);
    color: white;
}

.template-info {
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--color-on-surface-variant);
}

.template-info p {
    margin: 6px 0;
    line-height: 1.5;
}

.template-info strong {
    color: var(--color-on-surface);
    font-weight: 500;
}

.template-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--color-outline-variant);
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 32px;
}

.page-info {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.pagination .btn-outline {
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.pagination .btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

/* === Forms === */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--color-on-surface);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea,
.form-group input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-outline);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--color-white);
    color: var(--color-on-surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.help-text {
    font-size: 13px;
    color: var(--color-gray);
    margin-top: 6px;
    line-height: 1.4;
}

.help-text code {
    background: var(--color-surface-container);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--color-outline-variant);
}

/* === Tables === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    overflow-x: auto;
    display: block;
}

.data-table thead {
    background: var(--color-surface-container-low);
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-outline-variant);
}

.data-table th {
    font-weight: 500;
    color: var(--color-on-surface-variant);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--color-surface-container-low);
}

/* === Modal === */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
}

.modal-header {
    background: var(--color-white);
    color: var(--color-on-surface);
    padding: 24px 28px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--color-outline-variant);
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.modal-close {
    background: var(--color-surface-container);
    border: none;
    color: var(--color-on-surface-variant);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--color-surface-container-high);
    opacity: 1;
}

.modal-body {
    padding: 24px 28px 28px;
}

/* === Template View === */
.template-view-header h3 {
    font-size: 22px;
    margin-bottom: 16px;
    color: var(--color-on-surface);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.template-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.template-view-meta {
    background: var(--color-surface-container-low);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.meta-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.meta-item {
    font-size: 14px;
    color: var(--color-on-surface);
}

.meta-item strong {
    color: var(--color-on-surface-variant);
    font-weight: 500;
}

.template-placeholders,
.template-content,
.template-files,
.template-tags {
    margin-bottom: 24px;
}

.template-placeholders h4,
.template-content h4,
.template-files h4,
.template-tags h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-on-surface);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.placeholder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.placeholder-badge {
    background: var(--color-secondary-light);
    color: var(--color-secondary-dark);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.content-box {
    background: var(--color-surface-container-low);
    padding: 20px;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-secondary);
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--color-on-surface);
}

.file-list {
    list-style: none;
}

.file-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-outline-variant);
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.file-list li:hover {
    background: var(--color-surface-container-low);
}

.file-link {
    color: var(--color-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.file-link:hover {
    text-decoration: underline;
}

.file-size {
    color: var(--color-gray);
    font-size: 13px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--color-surface-container);
    color: var(--color-on-surface-variant);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
}

/* === History === */
.attached-files,
.history-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-outline-variant);
}

.attached-files h3,
.history-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-on-surface);
    letter-spacing: -0.01em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--color-surface-container-low);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-secondary);
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.history-date {
    color: var(--color-gray);
    font-size: 13px;
}

.history-changes {
    font-size: 13px;
    margin-top: 10px;
}

.change-item {
    margin: 5px 0;
    padding: 5px 0;
}

.change-item del {
    color: var(--color-danger);
    background: var(--color-danger-light);
    padding: 2px 6px;
    border-radius: 4px;
}

.change-item ins {
    color: var(--color-success);
    background: var(--color-success-light);
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.empty-state p {
    font-size: 17px;
    margin-bottom: 24px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
}

/* === Responsive Design === */

/* Tablets (768px+) */
@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo h1 i {
        font-size: 24px;
    }

    .nav {
        padding-bottom: 0;
    }

    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table {
        display: table;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        padding: 0 32px;
    }

    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    .filter-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Print Styles */
@media print {
    .header,
    .filter-section,
    .template-actions,
    .btn,
    .nav,
    .view-toggle,
    .col-actions {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .template-card,
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .templates-list-table-wrap {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
