:root {
    --color-primary-dark: #113f28;
    --color-primary-light: #82ae46;
    --color-bg-light: #f4f6f8;
    --color-surface: #ffffff;
    --color-text-dark: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-danger: #ef4444;
    --font-main: 'Outfit', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-block { width: 100%; }

.btn-primary { background-color: var(--color-primary-dark); color: white; }
.btn-primary:hover { background-color: #1a5c3a; }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-secondary { background-color: white; color: var(--color-text-dark); border: 1px solid var(--color-border); }
.btn-secondary:hover { background-color: #f9fafb; }

.btn-danger { background-color: white; color: var(--color-danger); border: 1px solid var(--color-danger); }
.btn-danger:hover { background-color: #fef2f2; }

/* Login Screen */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: var(--color-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.login-card h2 { margin-bottom: 0.5rem; color: var(--color-primary-dark); }
.login-card p { color: var(--color-text-muted); margin-bottom: 2rem; }

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(130, 174, 70, 0.1);
}

.help-text { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.error-text { color: var(--color-danger); font-size: 0.875rem; margin-bottom: 1rem; }

/* Dashboard Layout */
.admin-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand { display: flex; align-items: center; gap: 1rem; }
.header-logo { height: 40px; border-radius: 4px; }
.header-brand h1 { font-size: 1.25rem; color: var(--color-primary-dark); }

.header-actions { display: flex; align-items: center; gap: 1.5rem; }
.user-email { font-size: 0.875rem; color: var(--color-text-muted); }

.admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Tabs */
.actions-cell {
    white-space: nowrap;
}

.actions-cell button {
    margin-right: 0.5rem;
}

.main-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}
.tab-btn {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: var(--color-primary-dark);
}
.tab-btn.active {
    color: var(--color-primary-dark);
    border-bottom: 2px solid var(--color-primary-dark);
}

.profile-container {
    background: var(--color-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 800px;
}

/* Table */
.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

td { vertical-align: middle; }

.td-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background-color: #eee;
}

.td-actions { white-space: nowrap; }
.td-actions button { margin-right: 0.5rem; }

.loading-state {
    padding: 3rem;
    text-align: center;
    color: var(--color-text-muted);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--color-surface);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 1.5rem; right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
}

.modal-content h2 { margin-bottom: 1.5rem; color: var(--color-primary-dark); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.image-preview img {
    max-width: 100px;
    margin-top: 0.5rem;
    border-radius: 4px;
}

/* Responsividade */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .admin-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-nav {
        flex-wrap: wrap;
        margin-bottom: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }

    .user-email {
        word-break: break-all;
        text-align: center;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .login-card {
        padding: 1.5rem;
    }
}
