/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #0E578F 0%, #0a4170 100%);
    padding: 2rem 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
    flex: 1;
}

.sidebar-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    color: white;
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.sidebar-nav a.active {
    color: white;
    background: rgba(239, 136, 42, 0.3);
    border-left: 3px solid #EF882A;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: center;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    background-color: #f5f7fa;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #0E578F;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #7f8c8d;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0E578F 0%, #EF882A 100%);
    padding: 1rem;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    color: #0E578F;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #7f8c8d;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.auth-footer a {
    color: #0E578F;
    text-decoration: none;
    font-weight: 500;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #0E578F;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #EF882A;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #0E578F 0%, #0a4170 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 87, 143, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: transparent;
    border: 2px solid white;
    color: white;
}

.btn-outline:hover {
    background: white;
    color: #0E578F;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

/* Garantir que forms inline não adicionem espaçamento extra */
form[style*="display: inline"] {
    margin: 0;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Garantir que botões dentro de forms inline tenham o mesmo tamanho */
form[style*="display: inline"] .btn,
form[style*="display: inline"] button.btn {
    margin: 0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

.card h3 {
    color: #0E578F;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card-action {
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
}

.card-action:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* Botões nas células da tabela */
td .btn {
    margin-right: 0.25rem;
}

td .btn:last-child,
td form:last-child .btn {
    margin-right: 0;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #0E578F;
}

tr:hover {
    background: #f8f9fa;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fde8e8;
    color: #c53030;
    border-left: 4px solid #e74c3c;
}

.alert-success {
    background: #e8f8f0;
    color: #276749;
    border-left: 4px solid #27ae60;
}

/* Upload Area */
.upload-card {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #EF882A;
    background: #fff9f5;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-area input[type="file"] {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.file-name {
    font-weight: 500;
    color: #0E578F;
}

/* Info Box */
.info-box {
    background: #e8f1f7;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.info-box h4 {
    color: #0E578F;
    margin-bottom: 0.5rem;
}

.info-box ul {
    margin-left: 1.5rem;
    color: #34495e;
}

/* Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* Data List */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.data-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.data-item.highlight {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.data-label {
    color: #7f8c8d;
}

.data-value {
    font-weight: 500;
    color: #0E578F;
}

/* Preview Box */
.preview-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.preview-box h4 {
    margin-bottom: 1rem;
    color: #0E578F;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.preview-item.total {
    border-top: 2px solid #ddd;
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Fatura Grid */
.fatura-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .fatura-grid {
        grid-template-columns: 1fr;
    }
}

/* PIX Container */
.pix-container {
    text-align: center;
}

.qrcode {
    max-width: 200px;
    margin: 1rem auto;
    display: block;
}

.pix-instructions {
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.pix-code-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pix-code-container textarea {
    width: 100%;
    height: 80px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.75rem;
    resize: none;
}

/* Actions */
.actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.actions-bottom {
    margin-top: 2rem;
    text-align: center;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-success {
    color: #27ae60;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 1.5rem 0;
}

.observacoes {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.observacoes p {
    margin-top: 0.5rem;
    color: #34495e;
}

/* Section */
.section {
    margin-top: 2rem;
}

.section h2 {
    color: #0E578F;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-footer {
        border-top: none;
        padding: 1rem;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .container {
        padding: 1rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
}
