:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338ca;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --bg-color: #f3f4f6;
    --card-bg: #e8e5e2;
    --header-bg: #f5c262;
    --footer-bg: #f5c262;
    --input-border: #d1d5db;
    --input-focus: #4F46E5;
    --error-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
    padding: 1rem;
}

.login-container {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    margin-bottom: 2rem;
    text-align: center;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-logo {
    max-width: 150px;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remember-me input[type="checkbox"] {
    border-radius: 0.25rem;
    border-color: var(--input-border);
    color: var(--primary-color);
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.forgot-password:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: var(--primary-hover);
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Melhorias para dispositivos móveis */
@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem; /* Reduz padding interno em telas pequenas */
    }

    .login-header h1 {
        font-size: 1.25rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .forgot-password {
        font-size: 0.8rem;
    }
}

/* Ajustes para notebooks 1366x768 */
@media (max-width: 1366px), (max-height: 800px) {
    .login-container {
        max-width: 360px;
        padding: 2rem;
    }
    .login-logo {
        max-width: 120px;
        margin-bottom: 0.75rem;
    }
    .login-header h1 {
        font-size: 1.35rem;
        margin-bottom: 0.4rem;
    }
    .login-header p {
        font-size: 0.82rem;
    }
    .form-group {
        margin-bottom: 1rem;
    }
    .form-group input {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
    .form-actions {
        margin-bottom: 1.25rem;
    }
    .login-btn {
        padding: 0.625rem;
        font-size: 0.85rem;
    }
    .login-footer {
        margin-top: 1.25rem;
        font-size: 0.82rem;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Payroll */
.section {
    margin-top: 1rem;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.card {
    background: var(--card-bg);
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}
.card-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    color: var(--text-color);
}
.card-body {
    padding: 1rem;
    overflow-x: auto;
}
.employees-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.employees-grid-header,
.employee-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1.5fr;
    gap: 0.5rem;
    align-items: center;
}
.employees-grid-header {
    font-weight: 600;
    background: var(--bg-color);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}
.employee-row {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
}
.employee-row .actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}
.table th, .table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
}
.table th {
    background: var(--bg-color);
    color: var(--text-color);
}
.table tfoot td {
    background: var(--bg-color);
    font-weight: 600;
}
.btn {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
}
.btn:hover {
    background: var(--primary-hover);
}
.logout-btn {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: var(--error-color);
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.logout-btn:hover {
    filter: brightness(0.9);
}
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}
.btn-danger {
    background: var(--error-color);
}
.btn-danger:hover {
    filter: brightness(0.9);
}
.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    outline: none;
    font-size: 0.875rem;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.form-group label {
    margin-bottom: 0.25rem;
}

/* Theme Toggle */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
}

/* Dark Theme */
body.theme-dark {
    --bg-color: #0b0f19;
    --text-color: #e5e7eb;
    --text-secondary: #9ca3af;
    --card-bg: #111827;
    --header-bg: var(--card-bg);
    --footer-bg: var(--card-bg);
    --input-border: #374151;
    --primary-color: #4F46E5;
    --primary-hover: #4338ca;
}

/* Dark mode support adjustments */
body.theme-dark .module-card {
    background: #2d3748;
    border-color: #4b5563;
}
body.theme-dark .module-card:hover {
    background: #374151;
    border-color: var(--primary-color);
}

/* Fixed Layout Styles */
.app-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--input-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.app-logo {
    height: 48px;
    width: auto;
}

.app-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: var(--footer-bg);
    border-top: 1px solid var(--input-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    z-index: 1000;
    color: #111827;
    font-weight: 600;
    font-size: 0.95rem;
}

.app-footer-fixed p, 
.app-footer-fixed span {
    color: #111827;
    margin: 0;
}

.main-content-adjusted {
    margin-top: 80px;
    margin-bottom: 60px;
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
}

/* Center main content between fixed header and footer */
.app-main-center {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    padding-bottom: 60px;
    width: 100%;
}

@media (max-width: 1366px) {
    .app-header-fixed {
        padding: 0.5rem 1rem;
        min-height: 72px;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .app-header-fixed .header-actions {
        flex-wrap: wrap;
        row-gap: 0.4rem;
    }
    .header-left .welcome-text h1 {
        font-size: 1.25rem;
    }
    .app-logo {
        height: 40px;
    }
    .app-main-center {
        padding-top: 120px;
    }
    .login-page .app-header-fixed {
        display: none;
    }
    .login-page .app-main-center {
        padding-top: 40px;
        min-height: calc(100vh - 60px);
    }
}

@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .employees-grid-header,
    .employee-row {
        grid-template-columns: 1.8fr 1fr 1fr 1fr 1fr 1.2fr;
    }
}
@media (max-width: 640px) {
    .app-footer-fixed p {
        display: none;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .table {
        min-width: 560px;
    }
    .employees-grid-header,
    .employee-row {
        grid-template-columns: 1fr;
    }
    .table th, .table td {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--primary-color);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
/* Background Slider */
#bg-slider {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.bg-slide.active {
    opacity: 1;
}

body.bg-active {
    background-color: transparent !important;
}

/* Fullscreen Button */
.fullscreen-btn {
    background: var(--primary-color);
    border: 2px solid white;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-left: 10px;
    z-index: 1001;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    animation: fullscreen-pulse 2s infinite ease-in-out;
}

.fullscreen-btn:hover {
    transform: scale(1.15);
    background: var(--primary-hover);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    animation: none; /* Stop pulsing on hover */
}

@keyframes fullscreen-pulse {
    0% { transform: scale(1); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
    50% { transform: scale(1.1); box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4); }
    100% { transform: scale(1); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
}

.fullscreen-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.fullscreen-btn.animating svg {
    transform: rotate(180deg) scale(0);
    opacity: 0;
}

/* Virtual Keyboard */
.virtual-keyboard-container {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.95);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    z-index: 2000;
    width: 95%;
    max-width: 900px;
    display: none; /* Shown via JS */
    flex-direction: column;
    gap: 8px;
    user-select: none;
    border: 1px solid rgba(255,255,255,0.1);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key {
    background: #374151;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 45px;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.key:hover {
    background: #4B5563;
    transform: translateY(-2px);
}

.key:active {
    background: var(--primary-color);
    transform: translateY(1px);
}

.key.wide {
    min-width: 90px;
}

.key.extra-wide {
    min-width: 150px;
    flex-grow: 1;
}

.key.special {
    background: #1F2937;
    font-size: 0.9rem;
}

.key.shortcut {
    background: var(--primary-color);
    font-size: 0.85rem;
    padding: 8px 12px;
}

.key.backspace {
    background: #991B1B;
}

.key.enter {
    background: #065F46;
}

/* Display Divs for Input */
.input-display {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--input-border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    min-height: 42px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    position: relative;
}

.input-display.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-display:empty::before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
}

.input-display.password-display {
    letter-spacing: 3px;
    font-family: monospace;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2rem;
    background: var(--primary-color);
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

@media (max-width: 768px) {
    .key {
        padding: 8px;
        min-width: 35px;
        font-size: 0.9rem;
    }
    .key.wide { min-width: 70px; }
    .key.extra-wide { min-width: 100px; }
}
