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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    align-items: center;
}

.logo-text img {
    display: block;
    height: 42px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: #007bff;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.logo-text h1 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.logo-text p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 0;
}

.user-badge {
    width: 40px;
    height: 40px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid #e9ecef;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #e9ecef;
}

.sidebar-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.status-box {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-box input[type="checkbox"] {
    margin: 0;
}

.status-box label {
    color: #155724;
    font-size: 0.9rem;
    margin: 0;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.category-list:empty::after {
    content: "Nenhuma categoria encontrada";
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

.category-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.category-header {
    background: #f8f9fa;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.category-header:hover {
    background: #e9ecef;
}

.category-arrow {
    font-size: 12px;
    color: #666;
}

.category-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.file-count {
    color: #666;
    font-size: 0.9rem;
}

.file-list {
    background: white;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s;
}

.file-item:hover {
    background: #f8f9fa;
}

.file-item.active {
    background: #e3f2fd;
    color: #1976d2;
}

.file-item::before {
    content: "📄";
    font-size: 14px;
}

.file-item.approved::before {
    content: "✅";
    font-size: 14px;
}

.file-item.changes-requested::before {
    content: "⚠️";
    font-size: 14px;
}

/* Editor Panel */
.editor-panel {
    padding: 20px;
}

.editor-header {
    margin-bottom: 20px;
}

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

.editor-header h2 {
    color: #333;
    font-size: 1.3rem;
    margin: 0;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.approval-buttons {
    display: flex;
    gap: 10px;
}

/* Revision Status */
.revision-status {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.approval-status h4 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 10px;
}

.approval-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.approval-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 150px;
}

.approval-item.aprovado {
    border-color: #28a745;
    background: #f8fff9;
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.2);
}

.approval-item.pending {
    border-color: #6c757d;
    background: #f8f9fa;
    opacity: 0.6;
}

.approval-item.alteracoes_solicitadas {
    border-color: #dc3545;
    background: #fff8f8;
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.2);
}

.approval-item .approval-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    position: relative;
}

.approval-item.approved .approval-badge {
    background: #28a745;
    color: white;
}

.approval-item.approved .approval-badge::after {
    content: "✓";
    position: absolute;
    top: -2px;
    right: -2px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.approval-item.pending .approval-badge {
    background: #6c757d;
    color: white;
}

.approval-item.changes-requested .approval-badge {
    background: #dc3545;
    color: white;
}

.approval-item.changes-requested .approval-badge::after {
    content: "!";
    position: absolute;
    top: -2px;
    right: -2px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.placeholder {
    text-align: center;
    color: #999;
    padding: 60px 20px;
}

.placeholder p {
    font-size: 1.1rem;
}

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

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

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    overflow: hidden;
    transition: border-color 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Comments List Section */
.comments-list-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.comments-list-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.comments-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-user .user-badge {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.comment-user-name {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.comment-date {
    color: #666;
    font-size: 0.85rem;
}

.comment-content {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.no-comments {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Comment Section */
.comment-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.comment-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.comment-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comment-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn-light {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-light:hover:not(:disabled) {
    background: #e9ecef;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

/* Modal de histórico deve aparecer por cima da modal de conteúdo */
#historyModal {
    z-index: 2000;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover {
    color: #333;
}

.modal h3 {
    margin-bottom: 20px;
    color: #333;
}

.modal input,
.modal select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.modal input:focus,
.modal select:focus {
    outline: none;
    border-color: #007bff;
}

/* History Modal */
.history-list {
    max-height: 600px;
    overflow-y: auto;
}

.history-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.history-item:last-child {
    margin-bottom: 0;
}

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

.history-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.history-user .user-badge {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

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

.history-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.history-type.criacao {
    background: #d4edda;
    color: #155724;
}

.history-type.edicao {
    background: #cce5ff;
    color: #004085;
}

.history-type.revisao {
    background: #fff3cd;
    color: #856404;
}

.history-comment {
    color: #666;
    font-style: italic;
    margin-top: 8px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

/* History Badge */
.history-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

/* History Diff */
.history-diff {
    margin-top: 12px;
    border-top: 1px solid #e9ecef;
    padding-top: 12px;
}

.field-diff {
    margin-bottom: 16px;
}

.field-diff:last-child {
    margin-bottom: 0;
}

.diff-field-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.diff-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diff-version {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.diff-old {
    border-color: #f8d7da;
    background: #f8f9fa;
}

.diff-new {
    border-color: #d4edda;
    background: #f8f9fa;
}

.diff-label {
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.diff-old .diff-label {
    background: #dc3545;
}

.diff-new .diff-label {
    background: #28a745;
}

.diff-content {
    padding: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* Botão de histórico com posição relativa para o badge */
#viewHistoryBtn {
    position: relative;
}

/* Select de pecados (mobile) */
.pecado-select-container {
    margin-bottom: 20px;
}

.pecado-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.pecado-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Grid de números */
.numbers-grid {
    display: none; /* Escondido por padrão, mostrado em mobile */
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .numbers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.number-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.number-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.number-item.approved {
    border-color: #28a745;
    background: #f8fff9;
    color: #28a745;
}

.number-item.changes-requested {
    border-color: #ffc107;
    background: #fffbf0;
    color: #ffc107;
}

.number-item.has-comments {
    position: relative;
}

.number-item .comment-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #17a2b8;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Modal de conteúdo */
.content-modal .modal-content {
    padding: 0;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: 5vh auto;
}

.content-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
    position: relative;
}

.content-modal-header #modalSaveBtn {
    position: absolute;
    left: 20px;
    z-index: 1;
}

.content-modal-header h3 {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    padding: 0 60px; /* Espaço para os botões laterais */
}

.content-modal-header .modal-close-btn {
    position: absolute;
    right: 20px;
    z-index: 1;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.content-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

.content-modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

.content-modal-footer .btn {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: row;
        gap: 15px;
        align-items: center;
    }
    
    .header-actions {
        width: auto;
        justify-content: flex-end;
    }
    
    .container {
        padding: 10px;
    }
    
    .revision-buttons {
        flex-direction: column;
    }
    
    .approval-list {
        flex-direction: column;
    }
    
    /* Esconder lista antiga em mobile */
    .category-list {
        display: none;
    }
    
    /* Mostrar select em mobile */
    .pecado-select-container {
        display: block;
    }
    
    /* Grid será mostrado via JavaScript quando selecionar pecado */
    
    /* Grid responsivo - reduzir para 3 colunas em telas menores */
    @media (max-width: 480px) {
        .numbers-grid {
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }
    }
    
    /* Grid em telas muito pequenas */
    @media (max-width: 360px) {
        .numbers-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    
    /* Modal em mobile */
    .content-modal .modal-content {
        width: 95%;
        height: 95vh;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .content-modal-header {
        padding: 12px 15px;
    }
    
    .content-modal-body {
        padding: 15px;
    }
    
    .content-modal-footer {
        padding: 12px 15px;
        flex-direction: column;
    }
    
    .content-modal-footer .btn {
        width: 100%;
    }
}

/* Desktop - esconder select e grid */
@media (min-width: 769px) {
    .pecado-select-container,
    .numbers-grid {
        display: none;
    }
    
    .category-list {
        display: block;
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
