/* Dark Theme Variables */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #262626;
    --bg-tertiary: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #a8a8a8;
    --border-color: #3a3a3a;
    --input-bg: #2d2d2d;
    --card-bg: #252525;
    --accent-blue: #3498db;
    --accent-purple: #667eea;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100%;
}

/* Header and Navigation */
header {
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    padding: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-logo .material-icons {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #3498db;
}

/* User avatar and logout */
.nav-user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.user-avatar-placeholder {
    font-size: 36px;
    color: var(--text-secondary);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: var(--bg-tertiary);
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

/* Main Container */
main.container {
    max-width: 1200px;
    min-height: calc(100% - 256px);
    margin: 2rem auto;
    padding: 0 1rem 32px 1rem;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 2rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Grid */
.features {
    margin: 4rem 0;
}

.features h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    border-color: #667eea;
}

.feature-card .material-icons {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}
.btn:disabled {
    background-color: #555;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #3498db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background-color: rgba(52, 152, 219, 0.2);
    color: #2980b9;
}

.btn-icon.delete-btn {
    color: #ff6b6b;
}

.btn-icon.delete-btn:hover {
    background-color: rgba(244, 67, 54, 0.2);
    color: #ff6b6b;
}

.btn-icon.green-btn {
    background-color: #4CAF50;
    color: white;
}

.btn-icon.green-btn:hover {
    background-color: #66BB6A;
}

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

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Forms */
.form-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.form-group {
    position: relative;
    padding-bottom: 1.5rem;
}
.form-group[data-error]:after {
    content: attr(data-error);
    color: #ff6b6b;
    position: absolute;
    left: 0;
    bottom: 0;
    font-size: 14px;
}
.form-group[data-error] input,
.form-group[data-error] select,
.form-group[data-error] textarea {
    border-color: #ff4444;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-group textarea {
    resize: vertical;
    position: relative;
    margin-bottom: -8px;
}

.form-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--bg-tertiary);
    border-left: 4px solid #3498db;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.form-section h2,
.form-section h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

.error-message {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: block;
}

.item-grid {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-tertiary);
}
.item-grid:not(:last-child) {
    margin-bottom: 1rem;
}
.item-grid-row, .form-group-row {
    width: 100%;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.item-grid-row .form-group {
    flex: 1;
}

[data-clone] {
    display: none;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.data-table thead {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 4px 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.hours-cell {
    font-weight: 600;
    color: #667eea;
}

.hours-badge {
    display: inline-block;
    background-color: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.hours-badge-large {
    background-color: #667eea;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Difficulty Badges */
.difficulty-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* Status badges for progress screen */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status-nao-iniciada { background-color: #2196F3; color: white; }
.status-em-progresso { background-color: #FFA726; color: white; }
.status-concluida { background-color: #66BB6A; color: white; }

.difficulty-1 {
    background-color: #66BB6A;
    color: white;
}

.difficulty-2 {
    background-color: #FFA726;
    color: white;
}

.difficulty-3 {
    background-color: #EF5350;
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
}

.empty-state a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}
.modal.open {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-header h2 {
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Estimativa Creation UI */
.Estimativa-progress {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-info h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    position: relative;
    margin-bottom: -8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    position: relative;
    top: 8px;
}
table .progress-bar {
    top: 0;
    border-radius: 4px;
}

.progress-fill {
    height: 100%;
    background-color: #667eea;
    transition: width 0.3s ease;
    width: 0%;
}
.progress-fill.flow {
    position: relative;
    overflow: hidden;
}
.progress-fill.flow:before {
    content: '';
    display: block;
    position: relative;
    height: 4px;
    width: 100%;
    background: #8BC34A;
    opacity: .8;
    box-shadow: 0px 0px 20px 20px #8BC34A;
    transform: rotateZ(-45deg);
    left: -140px;
    animation: flow 2s linear infinite;
}
@keyframes flow {
    0% { left: -140px; }
    100% { left: calc(100% - 54px); }
}

[data-funcionalidades] {
    display: flex;
    overflow-x: hidden;
    flex-wrap: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    background: var(--card-bg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    flex-direction: column;
}

.funcionalidade-step {
    min-width: 100%;
    padding: 2rem;
}

.func-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.func-header h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.func-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.estimativa-item {
    background-color: var(--bg-tertiary);
    padding: 1rem;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}
.estimativa-item:last-child {
    margin-bottom: 0;
}

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

.estimativa-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.estimativa-item-edit {
    background-color: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.info-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.info-section h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

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

.info-item label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.info-item span {
    color: var(--text-secondary);
    font-size: 1rem;
}

.Estimativa-details {
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem 1rem;
    }

    .nav-menu {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .item-grid {
        grid-template-columns: 1fr;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .nav-logo {
        font-size: 1.1rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }
}

.center {
    text-align: center !important;
}
.right {
    text-align: right !important;
}

.loading-overlay {
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: -1;
}
.loading-spinner {
    text-align: center;
    color: white;
}
.loading-circle {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}
.loading-text {
    font-size: 18px;
    font-weight: bold;
}
body.loading .loading-overlay {
    z-index: 9999;
    opacity: 1;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

textarea.markdown {
    font-family: monospace !important;
}

[data-markdown] {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
    background: var(--input-bg);
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text-primary);
}
[data-markdown] > * {
    margin: 8px 0;
}
[data-markdown] > *:first-child {
    margin-top: 0;
}
[data-markdown] > *:last-child {
    margin-bottom: 0;
}
[data-markdown] ul {
    margin-left: 20px;
}

.radio-group {
    display: flex;
}
.radio-group > div {
    display: flex;
    align-items: center;
}
.radio-group > div > label {
    margin-bottom: 0;
    font-size: 14px;
    outline: none;
}
.radio-group > div > input {
    margin-right: 4px;
    margin-top: -2px;
    outline: none;
    height: 15px;
    width: 14px;
}
.radio-group > div > input:focus {
    outline: none;
    box-shadow: none;
}
