:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #4caf50;
    --error-color: #f44336;
    --warning-color: #ff9800;
    --info-color: #2196f3;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --bg-color: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand h1 {
    font-size: 28px;
    margin: 0;
    font-weight: 600;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 14px;
}

.user-info strong {
    font-weight: 600;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 30px 20px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Configuration Section */
.config-section {
    background: var(--white);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.config-section h2 {
    font-size: 22px;
    margin-bottom: 25px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    color: var(--text-light);
    font-size: 12px;
}

.form-group.checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.form-group.checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.form-group.checkbox small {
    margin-left: 26px;
    display: block;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: rgba(102, 126, 234, 0.05);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status Section */
.status-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-card {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.status-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: 500;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-idle {
    background: #f0f0f0;
    color: #666;
}

.status-idle .status-dot {
    background: #999;
}

.status-loading {
    background: #e3f2fd;
    color: var(--info-color);
}

.status-loading .status-dot {
    background: var(--info-color);
}

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

.status-success .status-dot {
    background: var(--success-color);
    animation: none;
}

.status-error {
    background: #ffebee;
    color: var(--error-color);
}

.status-error .status-dot {
    background: var(--error-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-details {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 5px;
    font-size: 12px;
    color: var(--text-light);
    font-family: 'Courier New', monospace;
    line-height: 1.4;
    word-break: break-all;
}

/* Test Logs */
.test-logs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.test-log-item {
    padding: 12px;
    border-left: 4px solid var(--border-color);
    background: #f9f9f9;
    border-radius: 3px;
    font-size: 12px;
}

.test-log-item.success {
    border-left-color: var(--success-color);
    background: #f1f8f4;
}

.test-log-item.error {
    border-left-color: var(--error-color);
    background: #faf3f3;
}

.test-log-time {
    color: #999;
    font-size: 11px;
    margin-bottom: 4px;
}

.test-log-message {
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 4px;
}

.test-log-error {
    color: var(--error-color);
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.empty-message {
    color: #999;
    text-align: center;
    padding: 20px;
}

/* Messages Container */
.messages-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.message.removing {
    animation: slideOut 0.3s ease;
}

.message-success {
    background: #c8e6c9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.message-error {
    background: #ffcdd2;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.message-warning {
    background: #ffe0b2;
    color: #e65100;
    border-left: 4px solid #ff9800;
}

.message-info {
    background: #bbdefb;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

.message-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.message-text {
    font-size: 12px;
    opacity: 0.9;
}

.message-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    flex-shrink: 0;
    opacity: 0.7;
    transition: var(--transition);
}

.message-close:hover {
    opacity: 1;
}

/* Boletos Section */
.boletos-section {
    background: var(--white);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-top: 30px;
}

.boletos-section h2 {
    font-size: 22px;
    margin-bottom: 25px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.boletos-search {
    margin-bottom: 30px;
}

.boletos-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.boletos-results {
    animation: fadeIn 0.3s ease;
}

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

.boletos-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.summary-card.highlight {
    background: linear-gradient(135deg, var(--success-color) 0%, #4caf50 100%);
    color: white;
}

.summary-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.summary-card.highlight .summary-label {
    color: rgba(255, 255, 255, 0.8);
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
}

.summary-card.highlight .summary-value {
    color: white;
}

.boletos-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.boleto-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: var(--transition);
    border-left: 4px solid var(--border-color);
}

.boleto-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.boleto-card.status-aberto {
    border-left-color: var(--info-color);
}

.boleto-card.status-liberado {
    border-left-color: var(--warning-color);
}

.boleto-card.status-pago {
    border-left-color: var(--success-color);
}

.boleto-card.status-vencido {
    border-left-color: var(--error-color);
}

.boleto-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.boleto-id {
    font-weight: 700;
    color: var(--text-color);
    font-size: 16px;
}

.boleto-status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.boleto-status-badge.aberto {
    background: #e3f2fd;
    color: var(--info-color);
}

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

.boleto-status-badge.pago {
    background: #e8f5e9;
    color: var(--success-color);
}

.boleto-status-badge.vencido {
    background: #ffebee;
    color: var(--error-color);
}

.boleto-field {
    margin-bottom: 12px;
}

.boleto-field-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.boleto-field-value {
    font-size: 16px;
    color: var(--text-color);
    font-weight: 500;
}

.boleto-valor {
    font-size: 20px;
    font-weight: 700;
    color: var(--success-color);
}

.boleto-vencimento {
    font-size: 14px;
    color: var(--text-light);
}

.boletos-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.boletos-loading p {
    color: var(--text-light);
    font-size: 16px;
    font-weight: 500;
}

.boletos-empty {
    text-align: center;
    padding: 60px 20px;
}

.boletos-empty .empty-message {
    font-size: 16px;
    color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-user {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .messages-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .config-section,
    .status-card {
        padding: 20px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .header-brand h1 {
        font-size: 24px;
    }
    
    .config-section h2,
    .status-card h3 {
        font-size: 18px;
    }
    
    .user-info {
        display: none;
    }
}
