/* ==========================================
   NÚCLEO DE PRÁTICAS AGRÍCOLAS - CSS MODERNIZADO
   Sistema Profissional de Gestão Rural - Dashboard Layout
   ========================================== */

/* Importar Fontes e Ícones */
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Variáveis CSS - Paleta Agrícola Moderna */
:root {
    /* Cores Primárias (Verde/Terra) */
    --primary-green: #388E3C; /* Verde Escuro - Principal */
    --primary-green-light: #4CAF50; /* Verde Médio - Hover */
    --primary-green-dark: #2E7D32; /* Verde Mais Escuro */
    --accent-yellow: #FFC107; /* Amarelo/Ouro - Destaque */
    --secondary-brown: #795548; /* Marrom Terra */

    /* Cores de Fundo e Layout */
    --bg-light: #F4F6F8; /* Fundo principal muito claro */
    --bg-white: #FFFFFF; /* Fundo de cards e painéis */
    --background-light: #F5F5F5; /* Fundo alternativo */
    --border-color: #E0E0E0; /* Linhas e bordas sutis */
    --shadow-color: rgba(0, 0, 0, 0.05);

    /* Cores de Texto */
    --text-primary: #212121; /* Texto principal */
    --text-secondary: #757575; /* Texto secundário/cinza */
    --text-light: #FFFFFF; /* Texto claro */

    /* Status */
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --info: #2196F3;

    /* Sombras */
    --shadow-sm: 0 1px 3px var(--shadow-color), 0 1px 2px var(--shadow-color);
    --shadow-md: 0 4px 6px var(--shadow-color), 0 1px 3px var(--shadow-color);

    /* Transições */
    --transition-fast: 0.2s ease-out;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body e Tipografia */
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout Principal - Dashboard */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Menu Fixo) */
.sidebar {
    width: 260px;
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    padding: 24px 0;
    position: fixed; /* Menu fixo */
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: width var(--transition-fast);
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-green-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
    border-left: 4px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(56, 142, 60, 0.05);
    color: var(--primary-green);
}

.sidebar-nav li a.active {
    background: rgba(56, 142, 60, 0.1);
    color: var(--primary-green-dark);
    border-left-color: var(--primary-green);
}

.sidebar-nav .material-icons-round {
    font-size: 24px;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: 260px; /* Espaço para a sidebar fixa */
    padding: 32px;
    transition: margin-left var(--transition-fast);
}

/* Container Padrão */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0; /* O padding já está no main-content */
}

/* Typography */
h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Material Icons Helper */
.material-icons-round {
    vertical-align: middle;
    user-select: none;
    font-family: 'Material Icons Round';
    font-weight: normal;
    font-style: normal;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* Page Header (Breadcrumb e Título) */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--primary-green);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--primary-green-dark);
}

.breadcrumb .material-icons-round {
    font-size: 16px;
}

/* Buttons */
.btn, .button, a.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-green);
    color: var(--text-light);
    text-decoration: none;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.btn:hover, .button:hover, a.button:hover, button:hover {
    background: var(--primary-green-light);
    box-shadow: 0 6px 10px rgba(56, 142, 60, 0.2);
    transform: translateY(-1px);
}

.btn:active, .button:active, a.button:active, button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn:disabled, .button:disabled, button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Variants */
.btn-secondary, .button-secondary {
    background: var(--text-secondary);
}

.btn-secondary:hover, .button-secondary:hover {
    background: #616161;
}

.btn-outline {
    background: transparent;
    color: var(--primary-green);
    border: 1px solid var(--primary-green);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary-green);
    color: var(--text-light);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: var(--error);
}

.btn-danger:hover {
    background: #E53935;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.action-bar .spacer {
    flex: 1;
}

/* Stats Badge */
.stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.stats-badge .material-icons-round {
    font-size: 20px;
    color: var(--primary-green);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
    border: 1px solid var(--border-color);
}

.card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-green);
    color: var(--text-light);
    box-shadow: 0 4px 8px rgba(56, 142, 60, 0.3);
}

.card-icon .material-icons-round {
    font-size: 32px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-content {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Stats Cards (Para lista.html) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.stat-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-green);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-icon-small {
    color: var(--primary-green);
    font-size: 24px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-top: 24px;
    background: var(--bg-white);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

thead {
    background: var(--bg-light);
}

th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px 20px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tbody tr {
    transition: background-color var(--transition-fast);
}

tbody tr:hover {
    background: rgba(56, 142, 60, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.table-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.table-actions a:hover {
    background: var(--border-color);
    color: var(--primary-green);
}

.table-actions a.danger:hover {
    color: var(--error);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-info {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-warning {
    background: #FFF3E0;
    color: #E65100;
}

/* Forms */
.form-section {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-section-header .material-icons-round {
    color: var(--primary-green);
    font-size: 24px;
}

.form-section-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

label .required {
    color: var(--error);
    font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-fast);
    background: var(--bg-light);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(56, 142, 60, 0.1);
    background: var(--bg-white);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    cursor: pointer;
}

/* Helper Text */
.helper-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Info Box (Melhorado) */
.info-box {
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary-green);
    margin: 24px 0;
    border: 1px solid var(--border-color);
}

.info-box-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.info-box-header .material-icons-round {
    color: var(--primary-green);
    font-size: 24px;
}

.info-box h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.info-box p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
    font-size: 14px;
}

/* Alert */
.alert {
    padding: 16px 20px;
    border-radius: 6px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
    font-size: 14px;
}

.alert .material-icons-round {
    font-size: 24px;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border-color: #4CAF50;
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border-color: #F44336;
}

.alert-warning {
    background: #FFF3E0;
    color: #E65100;
    border-color: #FF9800;
}

.alert-info {
    background: #E3F2FD;
    color: #1565C0;
    border-color: #2196F3;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    background: var(--bg-white);
    border-radius: 10px;
    border: 2px dashed var(--border-color);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon .material-icons-round {
    font-size: 40px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 16px 0;
        box-shadow: 0 2px 4px var(--shadow-color);
    }

    .sidebar-header {
        padding: 0 16px 16px;
        margin-bottom: 16px;
    }

    .sidebar-nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .sidebar-nav li a {
        padding: 8px 16px;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .sidebar-nav li a.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary-green);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-bar > * {
        width: 100%;
    }

    .action-bar .spacer {
        display: none;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }
    .sidebar-nav ul {
        flex-direction: column;
        align-items: stretch;
    }
    .sidebar-nav li a {
        justify-content: center;
    }
}

/* ========================================
   DARK MODE - Modo Escuro
   ======================================== */

/* Variáveis para Dark Mode */
[data-theme="dark"] {
    /* Cores Primárias (ajustadas para dark) */
    --primary-green: #4CAF50;
    --primary-green-light: #66BB6A;
    --primary-green-dark: #388E3C;
    --accent-yellow: #FFD54F;
    --secondary-brown: #A1887F;

    /* Cores de Fundo e Layout */
    --bg-light: #121212; /* Fundo principal escuro */
    --bg-white: #1E1E1E; /* Fundo de cards escuro */
    --background-light: #2C2C2C; /* Fundo alternativo */
    --border-color: #333333; /* Bordas escuras */
    --shadow-color: rgba(0, 0, 0, 0.3);

    /* Cores de Texto */
    --text-primary: #E0E0E0; /* Texto principal claro */
    --text-secondary: #B0B0B0; /* Texto secundário */
    --text-light: #FFFFFF;

    /* Status (ajustados) */
    --success: #66BB6A;
    --warning: #FFB74D;
    --error: #EF5350;
    --info: #42A5F5;

    /* Sombras mais fortes */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Ajustes específicos para elementos em dark mode */
[data-theme="dark"] .sidebar {
    background: #1E1E1E;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .card {
    background: #1E1E1E;
    border: 1px solid #333333;
}

[data-theme="dark"] .table {
    background: #1E1E1E;
}

[data-theme="dark"] .table thead {
    background: #2C2C2C;
}

[data-theme="dark"] .table tbody tr {
    border-bottom: 1px solid #333333;
}

[data-theme="dark"] .table tbody tr:hover {
    background: #2C2C2C;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #2C2C2C;
    border-color: #333333;
    color: #E0E0E0;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background: #2C2C2C;
    border-color: var(--primary-green);
    color: #E0E0E0;
}

[data-theme="dark"] .btn-outline {
    background: transparent;
    border-color: #333333;
    color: #E0E0E0;
}

[data-theme="dark"] .btn-outline:hover {
    background: #2C2C2C;
    border-color: var(--primary-green);
}

[data-theme="dark"] .info-box {
    background: #2C2C2C;
    border-color: #333333;
}

[data-theme="dark"] code {
    background: #2C2C2C;
    color: #FFD54F;
}

/* ========================================
   THEME TOGGLE SWITCH - Interruptor de Tema
   ======================================== */

.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.theme-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.theme-toggle input:checked + .theme-toggle-slider {
    background-color: var(--primary-green);
}

.theme-toggle input:checked + .theme-toggle-slider:before {
    transform: translateX(26px);
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.theme-toggle-label .material-icons-round {
    font-size: 18px;
}

/* Ícones de sol e lua */
.theme-icon-light {
    color: #FFC107;
}

.theme-icon-dark {
    color: #5E35B1;
}

/* Transição suave ao trocar de tema */
body,
.sidebar,
.main-content,
.card,
.table,
.form-control,
input,
textarea,
select,
.btn-outline {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
