/* Reset e Variáveis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e88e5;
    --primary-dark: #1565c0;
    --secondary-color: #43a047;
    --danger-color: #e53935;
    --warning-color: #fb8c00;
    --bg-color: #f5f5f5;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --excel-header: #217346;
    --excel-border: #d4d4d4;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(120% 120% at 10% 10%, #7dd3fc 0%, #6366f1 40%, #4c1d95 100%);
    position: relative;
    overflow: hidden;
}

.forest-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.forest-bg .aurora {
    position: absolute;
    inset: -20% -10% 0 -10%;
    background: radial-gradient(60% 40% at 20% 30%, rgba(34, 197, 94, 0.35), transparent 60%),
                radial-gradient(60% 50% at 80% 20%, rgba(16, 185, 129, 0.35), transparent 55%),
                radial-gradient(50% 50% at 50% 60%, rgba(59, 130, 246, 0.25), transparent 60%);
    filter: blur(12px);
    animation: auroraMove 18s ease-in-out infinite alternate;
}

.forest-bg .mist {
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: 15%;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.0), rgba(255,255,255,0.2) 40%, rgba(255,255,255,0.05));
    filter: blur(10px);
    opacity: 0.6;
    animation: mistDrift 22s ease-in-out infinite;
}

.forest-bg .stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.6), transparent 40%),
        radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.5), transparent 40%),
        radial-gradient(1px 1px at 60% 50%, rgba(255,255,255,0.4), transparent 40%),
        radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.35), transparent 40%),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.3), transparent 40%);
    opacity: 0.6;
    animation: twinkle 6s ease-in-out infinite alternate;
}

.forest-bg .hills {
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: -12%;
    height: 50%;
    background: radial-gradient(60% 100% at 15% 100%, #1b2a3a 20%, transparent 70%),
                radial-gradient(70% 100% at 55% 100%, #0f1e2e 18%, transparent 70%),
                radial-gradient(80% 100% at 90% 100%, #0b1420 18%, transparent 70%);
    opacity: 0.95;
}

.forest-bg .trees {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32%;
    background:
        linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(8, 18, 27, 0.55) 55%, rgba(8, 18, 27, 0.95) 100%),
        repeating-linear-gradient(90deg,
            rgba(8, 46, 38, 0.0) 0 24px,
            rgba(10, 60, 48, 0.35) 24px 26px,
            rgba(8, 46, 38, 0.0) 26px 44px
        );
    filter: blur(0.6px);
    opacity: 0.6;
}

.forest-bg .fireflies {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 10% 40%, rgba(253, 224, 71, 0.9), transparent 60%),
        radial-gradient(2px 2px at 30% 60%, rgba(250, 204, 21, 0.8), transparent 60%),
        radial-gradient(2px 2px at 55% 35%, rgba(253, 230, 138, 0.8), transparent 60%),
        radial-gradient(2px 2px at 75% 55%, rgba(254, 240, 138, 0.7), transparent 60%),
        radial-gradient(2px 2px at 90% 45%, rgba(252, 211, 77, 0.7), transparent 60%);
    animation: fireflies 7s ease-in-out infinite alternate;
    opacity: 0.9;
}

.login-container {
    position: relative;
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    position: relative;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(226, 252, 236, 0.9), rgba(240, 247, 255, 0.85) 45%, rgba(235, 244, 242, 0.8) 100%),
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(34, 197, 94, 0.06) 60%, rgba(14, 165, 233, 0.05));
    border-radius: 26px;
    box-shadow: 0 32px 90px rgba(7, 21, 32, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.75);
    padding: 50px 46px;
    animation: fadeInUp 0.6s ease;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(140px 140px at 18% 18%, rgba(34, 197, 94, 0.14), transparent 60%),
        radial-gradient(160px 160px at 88% 12%, rgba(14, 165, 233, 0.14), transparent 60%),
        radial-gradient(220px 220px at 50% 92%, rgba(16, 185, 129, 0.14), transparent 60%),
        repeating-linear-gradient(115deg, rgba(10, 66, 50, 0.06) 0 4px, rgba(255, 255, 255, 0.0) 4px 12px),
        repeating-linear-gradient(25deg, rgba(15, 99, 75, 0.04) 0 3px, rgba(255, 255, 255, 0.0) 3px 10px);
    opacity: 0.95;
    pointer-events: none;
}

.login-box::after {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.28);
    box-shadow: inset 0 0 24px rgba(16, 185, 129, 0.08);
    pointer-events: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-forest {
    width: 82px;
    height: 82px;
    margin: 0 auto 18px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(34, 197, 94, 0.45));
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.5), 0 12px 26px rgba(16, 185, 129, 0.45);
}

.login-header i {
    font-size: 40px;
    color: #0f766e;
    text-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.login-header h1 {
    font-size: 28px;
    color: #0f172a;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.login-header p {
    color: #4b5563;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.login-form label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.85);
    transition: all 0.3s;
    box-shadow: inset 0 1px 2px rgba(2, 6, 23, 0.05);
}

.login-form input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.error-message {
    background: #ffebee;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid var(--danger-color);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #0ea5e9 0%, #22c55e 50%, #15803d 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 16px 34px rgba(34, 197, 94, 0.4), 0 8px 18px rgba(14, 165, 233, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(34, 197, 94, 0.45), 0 10px 20px rgba(14, 165, 233, 0.3);
}

@keyframes auroraMove {
    0% {
        transform: translate3d(-2%, -1%, 0) scale(1.02);
    }
    100% {
        transform: translate3d(2%, 1%, 0) scale(1.08);
    }
}

@keyframes mistDrift {
    0% {
        transform: translateX(-3%);
    }
    100% {
        transform: translateX(3%);
    }
}

@keyframes twinkle {
    0% {
        opacity: 0.35;
    }
    100% {
        opacity: 0.75;
    }
}

@keyframes fireflies {
    0% {
        transform: translateY(0);
        opacity: 0.6;
    }
    100% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ========== DASHBOARD ========== */
.dashboard-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.sidebar-header h2 {
    color: white;
    font-size: 20px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 12px;
}

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

.user-info div {
    flex: 1;
}

.user-info span {
    display: block;
    color: white;
    font-weight: 500;
}

.user-info small {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(229, 57, 53, 0.1);
    color: #ef5350;
    border: 1px solid rgba(229, 57, 53, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    background: white;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.top-bar h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.top-bar-actions {
    display: flex;
    gap: 12px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

/* Excel Container */
.excel-container {
    flex: 1;
    margin: 24px 32px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.excel-toolbar {
    padding: 16px 20px;
    border-bottom: 2px solid var(--excel-border);
    display: flex;
    gap: 16px;
    background: #fafafa;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.filter-box select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}

.table-wrapper {
    flex: 1;
    overflow: auto;
}

/* Excel Table */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.excel-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.excel-table th {
    background: var(--excel-header);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #1a5934;
    white-space: nowrap;
}

.excel-table td {
    padding: 10px 16px;
    border: 1px solid var(--excel-border);
    background: white;
}

.excel-table tbody tr:hover {
    background: #f8f9fa;
}

.excel-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.excel-table tbody tr:nth-child(even):hover {
    background: #f0f2f4;
}

.loading-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
}

.table-footer {
    padding: 12px 20px;
    border-top: 2px solid var(--excel-border);
    background: #fafafa;
    font-size: 13px;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-edit {
    background: #e3f2fd;
    color: var(--primary-color);
}

.btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

.btn-delete {
    background: #ffebee;
    color: var(--danger-color);
}

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

.btn-view {
    background: #f3e5f5;
    color: #8e24aa;
}

.btn-view:hover {
    background: #8e24aa;
    color: white;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.modal-body textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #e8f5e9;
    color: var(--secondary-color);
}

.badge-warning {
    background: #fff3e0;
    color: var(--warning-color);
}

.badge-danger {
    background: #ffebee;
    color: var(--danger-color);
}

.badge-info {
    background: #e3f2fd;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
        transition: left 0.3s;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .top-bar h1 {
        font-size: 18px;
    }
    
    .excel-container {
        margin: 16px;
    }
    
    .excel-toolbar {
        flex-direction: column;
    }
}
