/* ========================================
   CENTRAL MILK - SISTEMA DE GESTÃO LEITEIRA
   Arquivo CSS Completo
   ======================================== */

/* === RESET E VARIÁVEIS === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #22C55E;
    --primary-dark: #16A34A;
    --primary-light: #86EFAC;
    --white: #FFFFFF;
    --black: #000000;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --red: #EF4444;
    --yellow: #F59E0B;
    --blue: #3B82F6;
    --sidebar-width: 280px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0F1419;
    color: #F9FAFB;
    line-height: 1.6;
    font-size: 15px;
}

/* === LAYOUT PRINCIPAL === */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    background: #1F2937;
    border-right: 1px solid #374151;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #374151;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #F9FAFB;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: var(--transition);
}

.sidebar-stats {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    border-bottom: 1px solid #374151;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #0F1419;
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #9CA3AF;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stat-alert {
    color: var(--red);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #D1D5DB;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: var(--transition);
    position: relative;
    font-weight: 500;
}

.nav-item:hover {
    background: #1F2937;
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-badge {
    position: absolute;
    right: 16px;
    background: var(--red);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #374151;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: #F9FAFB;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #1F2937;
    color: #D1D5DB;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--red);
    color: var(--white);
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.content-wrapper {
    padding: 32px;
    max-width: 1400px;
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #F9FAFB;
    margin-bottom: 4px;
}

.page-header p {
    color: #9CA3AF;
    font-size: 15px;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: none !important;
}

.btn-secondary {
    background: #1F2937;
    color: #D1D5DB;
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-text {
    background: transparent;
    color: var(--primary);
    padding: 8px 12px;
}

.btn-text:hover {
    background: #1F2937;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:active {
    transform: translateY(0);
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #1F2937;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #374151;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: none !important;
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-card-title {
    font-size: 13px;
    color: #9CA3AF;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: #F9FAFB;
    margin-bottom: 8px;
}

.stat-card-value.negative {
    color: var(--red);
}

.stat-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.stat-trend.up {
    color: var(--primary);
}

.stat-trend.down {
    color: var(--red);
}

.stat-info {
    color: #9CA3AF;
}

/* === DASHBOARD GRID === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: #1F2937;
    border-radius: 12px;
    border: 1px solid #374151;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #F9FAFB;
}

.card-body {
    padding: 24px;
}

/* === CHARTS === */
.chart-card .card-body {
    min-height: 300px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* === STATUS LIST === */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-weight: 600;
    color: #F9FAFB;
}

.status-count {
    font-size: 13px;
    color: #9CA3AF;
}

.status-bar {
    height: 8px;
    background: #1F2937;
    border-radius: 4px;
    overflow: hidden;
}

.status-progress {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* === LIST GROUP === */
.list-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #0F1419;
    transition: var(--transition);
}

.list-item:hover {
    background: #1F2937;
}

.list-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-icon.priority-baixa {
    background: var(--gray-200);
    color: #9CA3AF;
}

.list-icon.priority-média {
    background: #DBEAFE;
    color: var(--blue);
}

.list-icon.priority-alta {
    background: #FEF3C7;
    color: var(--yellow);
}

.list-icon.priority-urgente {
    background: #FEE2E2;
    color: var(--red);
}

.list-content {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-weight: 600;
    color: #F9FAFB;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.list-subtitle {
    font-size: 13px;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === EMPTY STATES === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    color: #9CA3AF;
    margin-bottom: 16px;
}

.empty-state-sm {
    text-align: center;
    padding: 24px;
}

.empty-state-sm p {
    color: #9CA3AF;
    font-size: 14px;
}

/* === ALERTS === */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
    position: relative;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: var(--transition);
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* === MODAIS === */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    background: rgba(0,0,0,0.6); 
    z-index: 9999 !important;
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
    overflow-y: auto;
}

.modal.active { 
    display: flex !important;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to { 
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

.modal-content { 
    background: #1F2937; 
    border-radius: 16px; 
    width: 90%; 
    max-width: 600px; 
    max-height: 85vh; 
    overflow: hidden;
    box-shadow: none !important;
    animation: slideUpModal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    margin: auto;
}

@keyframes slideUpModal {
    from { 
        transform: translateY(40px) scale(0.95); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

.modal-header { 
    padding: 24px 28px; 
    border-bottom: 1px solid #374151; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: linear-gradient(to bottom, var(--gray-50), var(--white));
}

.modal-header h3 { 
    margin: 0; 
    font-size: 20px;
    font-weight: 700;
    color: #F9FAFB;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

.modal-close { 
    background: none; 
    border: none; 
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 24px; 
    cursor: pointer; 
    color: #9CA3AF;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--gray-200);
    color: #F9FAFB;
    transform: rotate(90deg);
}

.modal-body { 
    padding: 28px; 
    max-height: calc(90vh - 180px);
    overflow-y: auto;
    background: #1F2937;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #1F2937;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.modal-footer { 
    padding: 20px 28px; 
    border-top: 1px solid #374151; 
    display: flex; 
    gap: 12px; 
    justify-content: flex-end;
    background: #0F1419;
}

/* Animação de saída do modal */
.modal.closing {
    animation: fadeOut 0.2s ease;
}

@keyframes fadeOut {
    from { 
        opacity: 1;
        backdrop-filter: blur(4px);
    }
    to { 
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

.modal.closing .modal-content {
    animation: slideDownModal 0.3s ease;
}

@keyframes slideDownModal {
    from { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
    to { 
        transform: translateY(40px) scale(0.95); 
        opacity: 0; 
    }
}

/* === FORMS === */
.form-row { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 16px; 
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #D1D5DB;
    font-size: 14px;
}

.form-control, select, textarea { 
    width: 100%; 
    padding: 12px 16px; 
    border: 1px solid var(--gray-300); 
    border-radius: 8px; 
    font-family: inherit;
    font-size: 15px;
    transition: all 0.2s;
    background: #1F2937;
}

.form-control:focus, select:focus, textarea:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: none !important; 
}

.form-control::placeholder {
    color: var(--gray-400);
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* === TABLES === */
.table-responsive { 
    overflow-x: auto; 
}

.table { 
    width: 100%; 
    border-collapse: collapse; 
}

.table th, .table td { 
    padding: 14px 12px; 
    text-align: left; 
    border-bottom: 1px solid #374151; 
}

.table th { 
    font-weight: 600; 
    color: #D1D5DB; 
    background: #0F1419; 
    font-size: 13px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.table tbody tr { 
    transition: all 0.2s; 
}

.table tbody tr:hover { 
    background: #0F1419; 
}

.table-sm { 
    font-size: 14px; 
}

.table-sm th, .table-sm td { 
    padding: 10px 12px; 
}

/* === BADGES === */
.badge { 
    padding: 5px 12px; 
    border-radius: 12px; 
    font-size: 12px; 
    font-weight: 600; 
    display: inline-block;
}

.badge-produzindo { background: #DCFCE7; color: #166534; }
.badge-seca { background: #FEF3C7; color: #92400E; }
.badge-gestante { background: #DBEAFE; color: #1E40AF; }
.badge-doente { background: #FEE2E2; color: #991B1B; }
.badge-descarte { background: var(--gray-200); color: #D1D5DB; }
.badge-volumoso { background: #DCFCE7; color: #166534; }
.badge-concentrado { background: #FEF3C7; color: #92400E; }
.badge-mineral { background: #DBEAFE; color: #1E40AF; }
.badge-suplemento { background: #FCE7F3; color: #9F1239; }
.badge-vacinacao { background: #DCFCE7; color: #166534; }
.badge-tratamento { background: #FEE2E2; color: #991B1B; }
.badge-exame { background: #DBEAFE; color: #1E40AF; }
.badge-inseminacao { background: #FCE7F3; color: #9F1239; }
.badge-parto { background: #FEF3C7; color: #92400E; }
.badge-diagnostico { background: #F3E8FF; color: #6B21A8; }
.badge-outros { background: var(--gray-200); color: #D1D5DB; }
.badge-prenha { background: #DCFCE7; color: #166534; }
.badge-vazia { background: #FEE2E2; color: #991B1B; }
.badge-aguardando { background: #FEF3C7; color: #92400E; }
.badge-abortou { background: var(--gray-200); color: #D1D5DB; }
.badge-excelente { background: #DCFCE7; color: #166534; }
.badge-boa { background: #DBEAFE; color: #1E40AF; }
.badge-regular { background: #FEF3C7; color: #92400E; }
.badge-ruim { background: #FEE2E2; color: #991B1B; }
.badge-recebido, .badge-pago { background: #DCFCE7; color: #166534; }
.badge-pendente { background: #FEF3C7; color: #92400E; }
.badge-atrasado { background: #FEE2E2; color: #991B1B; }
.badge-hoje { background: var(--primary); color: white; }
.badge-secagem { background: #FEF3C7; color: #92400E; }

/* === ACTION BUTTONS === */
.action-buttons { 
    display: flex; 
    gap: 6px; 
}

.btn-icon { 
    background: none; 
    border: none; 
    padding: 8px; 
    cursor: pointer; 
    color: #9CA3AF; 
    border-radius: 6px; 
    transition: all 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.btn-icon:hover { 
    background: #1F2937; 
    color: var(--primary); 
}

.btn-danger:hover { 
    background: #FEE2E2; 
    color: var(--red); 
}

.btn-icon-small {
    padding: 6px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #9CA3AF;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    background: #1F2937;
}

.btn-icon-small.btn-danger:hover {
    background: #FEE2E2;
    color: var(--red);
}

/* === LOGIN PAGE === */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
    color: var(--white);
}

.login-brand {
    margin-bottom: 48px;
}

.login-brand svg {
    margin-bottom: 16px;
}

.login-brand h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-brand p {
    font-size: 18px;
    opacity: 0.9;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.feature-item svg {
    flex-shrink: 0;
}

.feature-item span {
    font-size: 16px;
}

.login-right {
    width: 480px;
    background: #1F2937;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--gray-200);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #9CA3AF;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.login-form {
    display: none;
}

.login-form.active {
    display: block;
}

.login-info {
    text-align: center;
    margin-top: 16px;
    color: #9CA3AF;
}

.login-footer {
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
    margin-top: 32px;
}

/* === LEMBRETES === */
.lembretes-list { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

.lembrete-item { 
    display: flex; 
    gap: 16px; 
    padding: 20px; 
    background: #0F1419; 
    border-radius: 12px; 
    border-left: 4px solid var(--gray-300); 
    transition: all 0.2s; 
}

.lembrete-item:hover { 
    background: #1F2937; 
    box-shadow: none !important; 
}

.lembrete-item.priority-alta { 
    border-left-color: var(--yellow); 
}

.lembrete-item.priority-urgente { 
    border-left-color: var(--red); 
}

.lembrete-item.atrasado { 
    background: #FEE2E2; 
    border-left-color: var(--red); 
}

.lembrete-checkbox { 
    display: flex; 
    align-items: flex-start; 
    padding-top: 4px; 
}