/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #EDEEF7 0%, #E4FBFF 100%);
    min-height: 100vh;
    position: relative;
    margin-bottom: 100px;
}

/* Paper Texture Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(184, 181, 255, 0.1) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.title {
    font-size: 2.5rem;
    color: #7868E6;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(120, 104, 230, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 2rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #EDEEF7;
    flex-wrap: wrap;
    order: -1; /* Moves navigation to top on desktop */
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px 10px 0 0;
    padding: 0.5rem;
}

.tab-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.tab-btn:hover {
    background: rgba(184, 181, 255, 0.1);
    color: #7868E6;
}

.tab-btn.active {
    background: #7868E6;
    color: white;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #7868E6;
}

/* Tab Icons - Hidden on desktop, shown on mobile */
.tab-btn::before {
    content: '';
    width: 24px;
    height: 24px;
    display: none;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

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

/* Calculator Section */
.calculator-section {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.date-input,
.number-input,
.text-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #EDEEF7;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.date-input:focus,
.number-input:focus,
.text-input:focus {
    outline: none;
    border-color: #7868E6;
    box-shadow: 0 0 0 3px rgba(120, 104, 230, 0.1);
}

/* Method Selector */
.method-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    border: 2px solid #EDEEF7;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
}

.radio-label:hover {
    border-color: #B8B5FF;
    background: rgba(184, 181, 255, 0.1);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #EDEEF7;
    border-radius: 50%;
    margin-right: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #7868E6;
    background: #7868E6;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-nav {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 104, 230, 0.4);
}

.btn-secondary {
    background: #E4FBFF;
    color: #7868E6;
    border: 2px solid #7868E6;
}

.btn-secondary:hover {
    background: #7868E6;
    color: white;
}

.btn-danger {
    background: #FFB4B4;
    color: #8B0000;
}

.btn-danger:hover {
    background: #FF9999;
}

.btn-nav {
    background: #EDEEF7;
    color: #7868E6;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
}

.btn-nav:hover {
    background: #B8B5FF;
    color: white;
}

/* Results Section */
.results-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(228, 251, 255, 0.8), rgba(237, 238, 247, 0.8));
    border-radius: 15px;
    border: 1px solid rgba(120, 104, 230, 0.2);
}

.result-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #EDEEF7;
}

.result-item:last-child {
    border-bottom: none;
}

.highlight-date {
    font-size: 1.2rem;
    font-weight: 700;
    color: #7868E6;
    background: rgba(120, 104, 230, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* Milestones */
.milestones-section {
    margin-top: 1.5rem;
}

.milestones-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.milestone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border-left: 4px solid #7868E6;
}

.milestone-date {
    font-weight: 600;
    color: #7868E6;
}

/* Calendar Styles */
.calendar-section {
    max-width: 800px;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(120, 104, 230, 0.1);
    border-radius: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #EDEEF7;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.calendar-header-cell {
    background: #7868E6;
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.calendar-cell {
    background: white;
    padding: 1rem;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-cell:hover {
    background: rgba(184, 181, 255, 0.1);
}

.calendar-cell.other-month {
    color: #ccc;
    background: #f9f9f9;
}

.calendar-cell.today {
    background: #E4FBFF;
    font-weight: 700;
    color: #7868E6;
}

.calendar-cell.due-date {
    background: #FFB4B4;
    color: #8B0000;
    font-weight: 700;
}

.calendar-cell.milestone {
    background: #B8B5FF;
    color: #7868E6;
    font-weight: 600;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.due-date {
    background: #FFB4B4;
}

.legend-color.milestone {
    background: #B8B5FF;
}

.legend-color.today {
    background: #E4FBFF;
}

/* History Section */
.history-section {
    max-width: 800px;
    margin: 0 auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #7868E6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #7868E6;
}

.history-item-date {
    font-size: 0.9rem;
    color: #666;
}

.history-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.history-detail {
    display: flex;
    flex-direction: column;
}

.history-detail-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-detail-value {
    font-weight: 600;
    color: #333;
}

.delete-btn {
    background: #FFB4B4;
    color: #8B0000;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #FF9999;
}

.empty-state {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* FAQ Section */
.faq-section {
    max-width: 800px;
    margin: 0 auto;
}

.faq-list {
    display: grid;
    gap: 1rem;
}

.faq-item {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.faq-question {
    background: #EDEEF7;
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #7868E6;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: #B8B5FF;
    color: white;
}

.faq-question.active {
    background: #7868E6;
    color: white;
}

.faq-toggle {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.faq-question.active .faq-toggle {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.active {
    padding: 1.5rem;
    max-height: 500px;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #7868E6;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: #FFB4B4;
    color: #8B0000;
}

.toast.success {
    background: #7868E6;
    color: white;
}

/* Footer */
.footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 60px; /* Space for mobile nav */
}

.footer-info {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.1);
    order: 1; /* Appears after navigation on desktop */
}

.footer a {
    color: #7868E6;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        padding-bottom: 0; /* Remove extra padding */
    }
    
    .title {
        font-size: 2rem;
    }
    
    /* Footer becomes fixed bottom navigation */
    .footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin-top: 0;
        background: transparent;
    }
    
    /* Hide footer info on mobile */
    .footer-info {
        display: none;
    }
    
    /* Bottom Navigation for Mobile */
    .tab-navigation {
        position: relative;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid #EDEEF7;
        border-bottom: none;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        padding: 0.5rem 0;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        margin-bottom: 0;
        gap: 0;
        justify-content: space-around;
        z-index: 1000;
    }
    
    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.7rem;
        border-radius: 0;
        flex: 1;
        text-align: center;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 0;
        -webkit-tap-highlight-color: rgba(120, 104, 230, 0.2);
        user-select: none;
        color: #999; /* Cor cinza para inativos */
    }
    
    .tab-btn:active {
        background: rgba(120, 104, 230, 0.1);
    }
    
    /* Show icons on mobile */
    .tab-btn::before {
        display: block;
        margin-bottom: 0.25rem;
        transition: all 0.3s ease;
    }
    
    /* Calculator Icon */
    .tab-btn[data-tab="calculator"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Crect x='8' y='6' width='8' height='4' rx='1'/%3E%3Cline x1='8' y1='16' x2='8' y2='16'/%3E%3Cline x1='12' y1='16' x2='12' y2='16'/%3E%3Cline x1='16' y1='16' x2='16' y2='16'/%3E%3Cline x1='8' y1='20' x2='8' y2='20'/%3E%3Cline x1='12' y1='20' x2='12' y2='20'/%3E%3Cline x1='16' y1='20' x2='16' y2='20'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Crect x='8' y='6' width='8' height='4' rx='1'/%3E%3Cline x1='8' y1='16' x2='8' y2='16'/%3E%3Cline x1='12' y1='16' x2='12' y2='16'/%3E%3Cline x1='16' y1='16' x2='16' y2='16'/%3E%3Cline x1='8' y1='20' x2='8' y2='20'/%3E%3Cline x1='12' y1='20' x2='12' y2='20'/%3E%3Cline x1='16' y1='20' x2='16' y2='20'/%3E%3C/svg%3E");
    }
    
    /* Calendar Icon */
    .tab-btn[data-tab="calendar"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    }
    
    /* History/List Icon */
    .tab-btn[data-tab="history"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='8' y1='6' x2='21' y2='6'/%3E%3Cline x1='8' y1='12' x2='21' y2='12'/%3E%3Cline x1='8' y1='18' x2='21' y2='18'/%3E%3Cline x1='3' y1='6' x2='3.01' y2='6'/%3E%3Cline x1='3' y1='12' x2='3.01' y2='12'/%3E%3Cline x1='3' y1='18' x2='3.01' y2='18'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='8' y1='6' x2='21' y2='6'/%3E%3Cline x1='8' y1='12' x2='21' y2='12'/%3E%3Cline x1='8' y1='18' x2='21' y2='18'/%3E%3Cline x1='3' y1='6' x2='3.01' y2='6'/%3E%3Cline x1='3' y1='12' x2='3.01' y2='12'/%3E%3Cline x1='3' y1='18' x2='3.01' y2='18'/%3E%3C/svg%3E");
    }
    
    /* FAQ/Help Icon */
    .tab-btn[data-tab="faq"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
    }
    
    .tab-btn.active {
        background: transparent;
        color: #7868E6;
        box-shadow: none;
        position: relative;
    }
    
    /* Active indicator - dot below icon */
    .tab-btn.active::after {
        content: '';
        position: absolute;
        bottom: 0.25rem;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        background: #7868E6;
        border-radius: 50%;
        animation: pulse 2s ease-in-out infinite;
    }
    
    @keyframes pulse {
        0%, 100% {
            opacity: 1;
            transform: translateX(-50%) scale(1);
        }
        50% {
            opacity: 0.6;
            transform: translateX(-50%) scale(1.2);
        }
    }
    
    .tab-btn.active::before {
        transform: scale(1.1);
        filter: drop-shadow(0 2px 4px rgba(120, 104, 230, 0.3));
    }
    
    /* Adjust main content for bottom nav */
    .main-content {
        margin-bottom: 80px; /* Space for fixed bottom nav */
        padding-bottom: 1rem;
    }
    
    .calendar-grid {
        gap: 0;
    }
    
    .calendar-cell {
        min-height: 40px;
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .calendar-header-cell {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .legend-item {
        font-size: 0.9rem;
    }
    
    .history-item-details {
        grid-template-columns: 1fr;
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .method-selector {
        gap: 0.5rem;
    }
    
    .radio-label {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 1rem;
        margin-bottom: 85px; /* More space for bottom nav */
    }
    
    .tab-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .tab-btn::before {
        width: 22px;
        height: 22px;
    }
    
    .calendar-legend {
        gap: 1rem;
    }
    
    .legend-item {
        font-size: 0.8rem;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .tab-navigation,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .delete-btn {
        display: none;
    }
    
    .tab-content {
        display: block !important;
    }
    
    .main-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
