@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* Estilos comuns para as telas CRUD - AstroZapp (Material Design) */
:root {
    --md-primary-color: #3f51b5; /* Indigo */
    --md-primary-dark-color: #303f9f;
    --md-secondary-color: #e91e63; /* Pink */
    --md-background-color: #f5f5f5;
    --md-surface-color: #ffffff;
    --md-text-primary-color: #212121;
    --md-text-secondary-color: #757575;
    --md-divider-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-background-color);
    color: var(--md-text-primary-color);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 20px;
}

.header {
    background: var(--md-primary-color);
    color: white;
    padding: 20px 30px;
    border-radius: 0; /* App bar is not rounded */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: white;
    font-size: 1.5rem; /* Material Toolbar Title */
    font-weight: 500;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
    letter-spacing: 0.8px;
    outline: none;
}

.btn-primary {
    background-color: var(--md-primary-color);
    color: white;
    box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
}

.btn-primary:hover {
    background-color: var(--md-primary-dark-color);
    box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.2);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background-color: #f5f5f5;
    color: var(--md-text-primary-color);
    border: 1px solid var(--md-divider-color);
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.form-section, .list-section {
    background: var(--md-surface-color);
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    margin-bottom: 30px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.list-header h2 {
    margin: 0;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-form input {
    flex-grow: 1;
    max-width: 400px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--md-text-secondary-color);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--md-divider-color);
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    background-color: #f9f9f9;
    font-weight: 400; /* Reset font weight */
}

.form-control:focus {
    outline: none;
    border-color: var(--md-primary-color);
    box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.2);
    background-color: var(--md-surface-color);
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-col {
    flex: 1;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--md-divider-color);
}

.data-table th {
    background: var(--md-surface-color);
    font-weight: 500;
    color: var(--md-text-secondary-color);
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f7fafc;
}

.actions {
    display: flex;
    gap: 5px;
}

.alert {
    padding: 14px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #4caf50;
    color: white;
}

.alert-error {
    background-color: #f44336;
    color: white;
}

.search-box {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input {
    flex: 1;
    max-width: 300px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 8px 16px;
    border: 1px solid #cbd5e0;
    text-decoration: none;
    color: #4a5568;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background-color: #e2e8f0;
    border-color: #a0aec0;
}

.pagination .current {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    overflow-y: auto; /* Allow scrolling on the modal background */
    padding-top: 50px;
    padding-bottom: 50px;
}

.modal-content {
    background-color: var(--md-surface-color);
    margin: auto;
    padding: 24px;
    border-radius: 4px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 11px 15px -7px rgba(0,0,0,0.2), 0 24px 38px 3px rgba(0,0,0,0.14), 0 9px 46px 8px rgba(0,0,0,0.12);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        max-width: none;
    }
}

/* Estilos específicos para campos de data */
input[type="date"] {
    padding: 10px;
}

/* Estilos para textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Estilos para select */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
