/* ===== VARIÁVEIS CSS ===== */
:root {
    --primary-color: #0078d4;
    --primary-dark: #005a9e;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* ===== HEADER ===== */
.header {
    padding: 20px 30px;
    background: #ffffff;
    color: var(--text-color);
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border-bottom: 3px solid var(--primary-color);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 55px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.header .subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.upload-area {
    background: var(--card-bg);
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(0, 120, 212, 0.05);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-area h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}

.upload-area p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.upload-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.upload-btn:hover {
    background-color: var(--primary-dark);
}

.file-types {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 15px !important;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-top: 15px;
    box-shadow: var(--shadow);
}

.btn-update {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-update:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.file-name {
    font-weight: 600;
    color: var(--primary-color);
}

.btn-remove {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.btn-remove:hover {
    transform: scale(1.1);
}

/* ===== BARRA DE FERRAMENTAS ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== BOTÕES ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* ===== ESTATÍSTICAS ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== SEÇÃO DE REPOSITÓRIOS ===== */
.repositories-section h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.repositories-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

/* ===== CARDS DE REPOSITÓRIO ===== */
.repo-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.repo-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.repo-card.inactive {
    border-left-color: var(--secondary-color);
    opacity: 0.8;
}

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

.repo-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    word-break: break-word;
}

.repo-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.repo-status.active {
    background-color: #d4edda;
    color: #155724;
}

.repo-status.inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.repo-info {
    margin-bottom: 15px;
}

.repo-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.repo-info-item strong {
    color: var(--text-color);
}

.repo-params {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.repo-params h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.param-tag {
    display: inline-block;
    padding: 4px 10px;
    background-color: #e9ecef;
    border-radius: 15px;
    font-size: 0.8rem;
    margin: 3px;
    color: var(--text-color);
}

.param-tag.required {
    background-color: #fff3cd;
    color: #856404;
}

.repo-users {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.repo-users h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.user-tag {
    display: inline-block;
    padding: 4px 10px;
    background-color: #cce5ff;
    border-radius: 15px;
    font-size: 0.8rem;
    margin: 3px;
    color: #004085;
}

.btn-details {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-details:hover {
    background-color: var(--primary-color);
    color: white;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.modal-header h2 {
    font-size: 1.3rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.sql-preview {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.params-table {
    width: 100%;
    border-collapse: collapse;
}

.params-table th,
.params-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.params-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-color);
}

.params-table tr:hover {
    background-color: #f8f9fa;
}

/* ===== PREVIEW SECTION ===== */
.preview-section {
    margin-top: 30px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    color: white;
}

.preview-header h2 {
    font-size: 1.2rem;
}

.markdown-preview {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 25px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 500px;
    overflow-y: auto;
    margin: 0;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: white;
    padding: 15px 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.toast.toast-error {
    background: linear-gradient(135deg, #dc3545 0%, #ff6b6b 100%);
}

.toast.toast-info {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* ===== SEÇÃO SQL ===== */
.sql-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    margin-top: 30px;
    box-shadow: var(--shadow);
}

.sql-section h2 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.sql-section p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.sql-container {
    position: relative;
    background: #1e1e1e;
    border-radius: var(--radius);
    overflow: hidden;
}

.btn-copy-sql {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.btn-copy-sql:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.sql-code {
    margin: 0;
    padding: 20px;
    padding-top: 50px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #d4d4d4;
    background: #1e1e1e;
}

.sql-code code {
    color: #9cdcfe;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 30px 15px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .toolbar {
        flex-direction: column;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .search-input {
        min-width: 100%;
    }

    .repositories-list {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.repo-card {
    animation: fadeIn 0.4s ease forwards;
}

.repo-card:nth-child(1) { animation-delay: 0.05s; }
.repo-card:nth-child(2) { animation-delay: 0.1s; }
.repo-card:nth-child(3) { animation-delay: 0.15s; }
.repo-card:nth-child(4) { animation-delay: 0.2s; }
.repo-card:nth-child(5) { animation-delay: 0.25s; }
.repo-card:nth-child(6) { animation-delay: 0.3s; }

/* ===== SCROLLBAR PERSONALIZADA ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

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

/* ===== LOADING ===== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}
