* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fafafa;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: #111;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.tabs {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
.tab-btn {
    background: #fff;
    border: 1px solid #dbdbdb;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
}
.tab-btn.active {
    background: #efefef;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Seção de Captura */
.capture-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 4/3;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.camera-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border: 3px solid #fff;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(45deg, #c381cd, #9d1ea4);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #fa8a1c, #c381cd);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #b40000, #430030);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #fa8a1c, #9d1ea4);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #430030, #85088c);
    color: white;
}

/* Preview da Foto */
.photo-preview {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.photo-preview h3 {
    margin-bottom: 15px;
    color: #333;
}

#previewImage {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#editorCanvas {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 2px dashed #c381cd;
}

.preview-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.opacity-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hint {
    font-size: 0.85rem;
    color: #666;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.face-analysis {
    background: #f0f8ff;
    border: 1px solid #c381cd;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.face-analysis h4 {
    margin: 0 0 8px 0;
    color: #85088c;
    font-size: 14px;
}

.face-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    font-size: 12px;
}

.face-tag {
    background: #e8f4fd;
    border: 1px solid #9d1ea4;
    border-radius: 4px;
    padding: 4px 6px;
    text-align: center;
    color: #333;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}

.transform-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.flip-group {
    display: flex;
    gap: 12px;
}

.aspect-row {
    display: flex;
    gap: 10px;
}

#photoCaption {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#photoCaption:focus {
    outline: none;
    border-color: #85088c;
}

/* Seção do Painel */
.panel-section {
    background: transparent;
    border-radius: 0;
    padding: 0 0 25px 0;
    box-shadow: none;
}

.panel-section h2 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.panel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.photo-count {
    background: #85088c;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

/* Container de Posts */
.posts-container {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    max-width: 600px;
    margin: 0 auto;
}

.posts-container::-webkit-scrollbar {
    width: 6px;
}

.posts-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.posts-container::-webkit-scrollbar-thumb {
    background: #85088c;
    border-radius: 3px;
}

.post-item {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #dbdbdb;
    overflow: hidden;
}

.post-item:hover { }

.post-image {
    display: block;
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: #000;
}

.post-caption {
    font-size: 14px;
    color: #222;
    padding: 0 16px 8px 16px;
}

.post-meta {
    display: none;
}

.post-actions {
    display: flex;
    gap: 10px;
    padding: 8px 10px 6px 10px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.action-btn:hover { background-color: rgba(0,0,0,0.06); }
.action-btn.liked { color: #ed4956; }

.likes-row {
    font-weight: 600;
    padding: 0 16px;
    margin-bottom: 6px;
    font-size: 14px;
}

.timestamp {
    color: #8e8e8e;
    font-size: 12px;
    padding: 0 16px 12px 16px;
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
}
.post-header .left { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: #ddd; border: 1px solid #ccc;
}
.username { font-weight: 600; font-size: 14px; }
.more { background: none; border: none; font-size: 20px; cursor: pointer; color: #555; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-item {
    animation: fadeIn 0.5s ease;
}

/* Responsividade */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .panel-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Modal genérico */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 520px;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal-content h3 {
    margin-bottom: 10px;
    color: #430030;
}

.modal-content p {
    margin-bottom: 16px;
    color: #444;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-note {
    display: block;
    margin-top: 12px;
    color: #666;
}

/* Analysis Modal */
.analysis-modal {
    max-width: 500px;
    text-align: center;
    background: linear-gradient(135deg, #430030, #85088c);
    color: white;
}

.analysis-modal h3 {
    color: white;
    margin-bottom: 20px;
}

.analysis-progress {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c381cd, #fa8a1c);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.analysis-status {
    color: white;
    font-size: 14px;
    margin-bottom: 15px;
}

.characteristics-list {
    text-align: left;
    margin: 15px 0;
    max-height: 200px;
    overflow-y: auto;
}

.characteristic-item {
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #c381cd;
    opacity: 0;
    animation: slideIn 0.5s ease forwards;
}

.characteristic-item.analyzed {
    border-left-color: #fa8a1c;
    background: rgba(250, 138, 28, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.comparison-results {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid #c381cd;
}

.final-result {
    font-size: 18px;
    font-weight: bold;
    color: #fa8a1c;
    margin-bottom: 10px;
}

.confidence-score {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}
