/* Estilos gerais */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #3498db;
}

.btn-success {
    background-color: #2ecc71;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-secondary {
    background-color: #95a5a6;
}

/* Alertas */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Autenticação */
.auth-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Layout do Dashboard */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    padding: 20px;
}

.sidebar h3 {
    color: white;
    margin-bottom: 30px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 15px;
}

.sidebar-menu a {
    color: #ecf0f1;
    display: block;
    padding: 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: #34495e;
    text-decoration: none;
}

.main-content {
    flex: 1;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info span {
    margin-right: 10px;
}

/* Menu do usuário */
.user-menu {
    position: relative;
}
.user-menu-toggle {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.user-dropdown {
    position: absolute;
    right: 0;
    top: 110%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 180px;
    display: none;
    z-index: 1000;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
    display: block;
    padding: 10px 12px;
    color: #333;
}
.user-dropdown a:hover {
    background: #f5f5f5;
}

/* Tabelas */
.table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

tr:hover {
    background-color: #f5f5f5;
}

/* Cards */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

/* Templates UTM */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.template-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    background: #fff;
}
.template-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.template-meta {
    font-size: 12px;
    color: #6b7280;
}
.template-code {
    font-size: 12px;
    color: #374151;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 6px;
}
.template-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}
.chip {
    display: inline-block;
    font-size: 12px;
    color: #111827;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 4px 8px;
    border-radius: 999px;
}
.chip-empty {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #6b7280;
}
.template-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.template-status {
    margin-top: 6px;
    font-size: 12px;
}
.template-status.active { color: #10b981; }
.template-status.inactive { color: #6b7280; }

/* Modal */
.modal { display: none; }
.modal.open { display: block; }
.modal .modal-content {
    position: fixed;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    min-width: 520px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    z-index: 2000;
}
.modal .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal .close { background: transparent; border: none; font-size: 22px; cursor: pointer; }
.param-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.param-row .param-key { min-width: 160px; max-width: fit-content;}
.param-row .param-value { flex: 1; }
.param-row .btn-del { padding: 8px 10px; }


.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Utilitários */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Responsividade */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .auth-container {
        margin: 20px auto;
    }
}