/* Reset e Base - Calcato Shared Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0B5A9D;
    --primary-dark: #094F8B;
    --secondary-color: #4CAF50;
    --accent-color: #FF9800;
    --text-primary: #212121;
    --text-secondary: #757575;
    --background: #f8f9fa;
    --white: #ffffff;
    --border: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 16px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.robot-icon {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
    animation: robotWave 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.robot-icon:hover {
    transform: scale(1.1);
    animation-play-state: paused;
}

@keyframes robotWave {
    0%, 100% { 
        transform: rotate(0deg) translateY(0px);
    }
    25% { 
        transform: rotate(-3deg) translateY(-2px);
    }
    50% { 
        transform: rotate(0deg) translateY(-1px);
    }
    75% { 
        transform: rotate(3deg) translateY(-2px);
    }
}

.title-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#app-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

#app-subtitle {
    font-size: 0.9rem;
    font-weight: 300;
    margin: 2px 0 0 0;
    opacity: 0.9;
    line-height: 1.2;
}

/* Ad Containers */
.ad-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.ad-placeholder {
    min-height: 90px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 728px;
    width: 100%;
}

/* Main Content */
main {
    margin: 24px auto;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border: none;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #45a049);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-color), #f57c00);
}

/* Cards */
.card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 24px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Footer */
footer {
    background: var(--text-primary);
    color: var(--white);
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
}

footer p {
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.8;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-overlay p {
    color: var(--text-primary);
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Tooltips */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
}

.tooltip-container:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Form Validation */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-error {
    color: #e53e3e;
    font-size: 0.85rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-error::before {
    content: '⚠️';
}

.form-success {
    color: #38a169;
    font-size: 0.85rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-success::before {
    content: '✅';
}

.input-error {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1) !important;
}

.input-success {
    border-color: #38a169 !important;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    #app-title {
        font-size: 1.2rem;
    }
    
    .robot-icon {
        width: 36px;
        height: 36px;
    }
    
    .card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .robot-icon {
        width: 48px;
        height: 48px;
    }
    
    #app-title {
        font-size: 1.4rem;
    }
    
    #app-subtitle {
        font-size: 0.8rem;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced focus states */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Announce region for screen readers */
.sr-announce {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text-secondary: #000;
        --shadow: 0 2px 10px rgba(0,0,0,0.5);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text-secondary: #000;
        --shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
}

/* Print styles */
@media print {
    .ad-container,
    header,
    footer {
        display: none;
    }
}

/* Breadcrumb Component */
.breadcrumb {
    background: linear-gradient(135deg, var(--white), #f8f9fa);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin: 24px 0;
    border-left: 4px solid var(--primary-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.breadcrumb-icon {
    margin-right: 12px;
    font-size: 1rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb .separator {
    color: var(--border);
    margin: 0 8px;
    font-weight: bold;
}

.breadcrumb .separator::before {
    content: '›';
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Cards "Em Breve" - Classe Universal */
.coming-soon {
    opacity: 0.8;
    position: relative;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    border: 2px dashed #dee2e6 !important;
}

.coming-soon h3 {
    color: var(--text-secondary) !important;
}

.coming-soon p {
    color: #6c757d !important;
}

.coming-soon .features li {
    color: #6c757d !important;
}

.coming-soon .features li::before {
    color: #6c757d !important;
}

.coming-soon .icon {
    opacity: 0.7;
}

/* Desabilita hover nos cards "em breve" */
.coming-soon:hover {
    transform: none !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
}

.btn.btn-disabled {
    background: #6c757d !important;
    cursor: not-allowed;
    text-decoration: none;
    pointer-events: none;
}

.btn.btn-disabled:hover {
    background: #6c757d !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Voltar ao Topo Component */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    backdrop-filter: blur(8px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1565C0);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.4);
}

.back-to-top:active {
    transform: translateY(-1px) scale(0.95);
}

.back-to-top::before {
    content: '↑';
    font-weight: bold;
    font-size: 22px;
    line-height: 1;
}

/* Animação de pulso quando aparecer */
.back-to-top.visible {
    animation: backToTopAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes backToTopAppear {
    0% {
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px) scale(0.8);
    }
    50% {
        transform: translateY(-5px) scale(1.1);
    }
    100% {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }
}

/* Progress ring around button */
.back-to-top::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: linear-gradient(to bottom, var(--primary-color), transparent) border-box;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.back-to-top:hover::after {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .back-to-top::before {
        font-size: 20px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.1s ease;
        animation: none;
    }
    
    .back-to-top:hover {
        transform: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .back-to-top {
        border: 2px solid var(--white);
    }
}

/* Tooltip for back to top */
.back-to-top[data-tooltip]:hover::after {
    display: none; /* Remove default tooltip animation for this specific case */
}

.back-to-top-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
    pointer-events: none;
}

.back-to-top-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: var(--text-primary);
}

.back-to-top:hover .back-to-top-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Accessibility improvements */
.back-to-top:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

/* ===== BACK TO TOP COMPONENT ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top:active {
    transform: translateY(0);
}

.back-to-top::before {
    content: "↑";
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
}

/* Animação de pulso quando aparece */
.back-to-top.pulse {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ===== CALCATO SUGGESTIONS ===== */
.calcato-suggestion {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    display: none;
    animation: slideInUp 0.5s ease-out;
}

.calcato-suggestion.show {
    display: block;
}

.calcato-suggestion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.calcato-suggestion-icon {
    font-size: 24px;
    animation: bounce 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calcato-suggestion-icon .calcato-icon {
    width: 28px;
    height: 28px;
    animation: bounce 2s infinite;
}

.calcato-suggestion-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.calcato-suggestion-text {
    font-size: 16px;
    line-height: 1.6;
    color: #424242;
    margin-bottom: 16px;
}

.calcato-suggestion-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.calcato-suggestion-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 14px;
}

.calcato-suggestion-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.calcato-suggestion-link .emoji {
    font-size: 16px;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Responsive */
@media (max-width: 768px) {
    .calcato-suggestion {
        padding: 20px;
        margin: 20px 0;
    }
    
    .calcato-suggestion-links {
        flex-direction: column;
    }
    
    .calcato-suggestion-link {
        justify-content: center;
        padding: 12px 20px;
    }
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 16px;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Error Popup Styles */
.calcato-error-overlay {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.calcato-error-popup {
    animation: errorPopupSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.calcato-error-field {
    transition: all 0.3s ease;
}

@keyframes errorPopupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.calcato-error-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.calcato-error-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(244, 67, 54, 0.3);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .calcato-error-popup {
        background: #2d2d2d;
        color: #ffffff;
    }
    
    .calcato-error-title {
        color: #ffffff;
    }
    
    .calcato-error-message {
        color: #cccccc;
    }
    
    .calcato-error-hint {
        background: #1a1a1a;
        border-color: #404040;
        color: #cccccc;
    }
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .calcato-error-popup {
        margin: 16px;
        width: calc(100% - 32px);
    }
}
