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

:root {
    /* Tema (padrão “dashboard” como o site de referência) */
    --primary: #0f8a3b;
    --primary-dark: #0b6a2d;
    --secondary: #f57c00;
    --danger: #dc3545;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --background: #f4f6f9;
    --surface: #ffffff;
    --text: #111827;
    --text-secondary: #6b7280;
    /* Linhas/bordas (mais escuras, como você pediu) */
    --border: #b6c0cf;
    --border-light: #d6dde8;
    --shadow: rgba(17, 24, 39, 0.08);

    --radius: 10px;
    --sidebar-width: 240px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Melhor legibilidade e consistência */
img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

/* Loading inicial */
body.loading {
    background: white;
}

body.loading::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.loading::after {
    content: 'Carregando...';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100000;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 600;
}

/* Login Page */
#login-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    z-index: 9999;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    max-width: 450px;
    width: 90%;
    text-align: center;
}

.login-logo {
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-card h1 {
    font-size: 1.75rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.btn {
    padding: 0.65rem 1.15rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-large {
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 138, 59, 0.22);
}

#auth-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

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

/* Navbar Top */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 3px solid var(--secondary);
    display: none;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.logged-in .navbar {
    display: flex;
}

.nav-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.nav-toggle:hover {
    background: var(--background);
    border-color: var(--secondary);
}

.nav-toggle:active {
    transform: translateY(1px);
}

.brand-logo {
    height: 35px;
    width: auto;
}

.nav-brand span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.user-email {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.user-info i {
    font-size: 1.25rem;
    color: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-outline:hover {
    background: var(--background);
    border-color: var(--primary);
    color: var(--primary);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: var(--sidebar-width);
    height: calc(100vh - 60px);
    background: white;
    border-right: 3px solid var(--secondary);
    overflow-y: auto;
    z-index: 900;
    display: none;
}

.sidebar-backdrop {
    display: none;
}

body.logged-in .sidebar {
    display: block;
}

.sidebar-user {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
    background: #fafafa;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.sidebar-user-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-user-email {
    font-size: 0.78rem;
    color: var(--text-secondary);
    word-break: break-word;
}

.sidebar-menu {
    padding: 1rem 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
}

.menu-item:hover {
    background: #f5f5f5;
    border-left-color: var(--primary);
}

.menu-item.active {
    background: rgba(15, 138, 59, 0.10);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.menu-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: 60px;
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - 60px);
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h1 i {
    color: var(--primary);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.warning {
    border-left-color: #FDD835;
    background: #fffbeb;
}

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

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green {
    background: #e8f5e9;
    color: var(--primary);
}

.stat-icon.yellow {
    background: #FFF9C4;
    color: #F9A825;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-link {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
}

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

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Calendar Toolbar (acesso rápido) */
.calendar-toolbar {
    margin-bottom: 1.5rem;
}

.toolbar-row {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.toolbar-title {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--text);
}

.toolbar-title i {
    color: var(--primary);
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: min(640px, 100%);
}

.toolbar-controls select {
    flex: 1;
    min-width: 220px;
}

/* Section Card */
.section-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 i {
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Form */
.appointment-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

label i {
    margin-right: 0.25rem;
    color: var(--primary);
    width: 16px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.15);
}

textarea {
    resize: vertical;
}

.input-with-icon {
    display: flex;
    gap: 0.5rem;
}

.input-with-icon select {
    flex: 1;
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-button:hover {
    background: var(--background);
    color: var(--primary);
    border-color: var(--primary);
}

.icon-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.form-actions .btn-primary {
    width: 100%;
}

/* Events List */
.events-list {
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
}

.event-item {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    transition: all 0.2s;
    background: white;
}

.event-item:hover {
    box-shadow: 0 2px 8px var(--shadow);
}

.event-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: var(--primary);
    color: white;
}

.event-item h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.event-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.event-calendar {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.event-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.event-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

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

.btn-danger:hover {
    background: #c82333;
}

.no-events {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.no-events i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    display: block;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Status Messages */
.status-message-floating {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow);
    font-weight: 500;
    display: none;
    z-index: 2000;
    background: white;
}

.status-message-floating.success {
    background: #e8f5e9;
    color: var(--primary-dark);
    border-left: 4px solid var(--primary);
}

.status-message-floating.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid var(--danger);
}

.status-message-floating.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    padding: 2rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--background);
    color: var(--text);
}

.modal-actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: #fafafa;
}

#edit-form {
    padding: 1.5rem;
}

/* Update Badge */
.update-badge {
    background: var(--primary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: inline-flex;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 60px 0 0 0;
        background: rgba(17, 24, 39, 0.35);
        z-index: 850;
        display: none;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .sidebar {
        width: 260px;
        transform: translateX(-110%);
        transition: transform 0.25s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .user-info span {
        display: none;
    }

    .user-email {
        display: none;
    }

    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-controls {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .event-actions {
        flex-direction: column;
    }
    
    .event-actions .btn {
        width: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
