/* =============================================
   ORGANIZADOR HALLEY - TEMA ESCURO
   ============================================= */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0d1117;
    color: #e6edf3;
    min-height: 100vh;
}

/* HEADER */
.header {
    background: linear-gradient(135deg, #1a1e2e, #0d1117);
    border-bottom: 2px solid #7c3aed;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left h1 {
    font-size: 28px;
    color: #a78bfa;
}

.header-left h1 span {
    color: #7c3aed;
    font-weight: 800;
}

.header-subtitle {
    font-size: 13px;
    color: #484f58;
    margin-top: 4px;
}

.header-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #8b949e;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #f85149;
    flex-shrink: 0;
}

.status-dot.connected {
    background-color: #3fb950;
}

.status-dot.loading {
    background-color: #d29922;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* SECTIONS */
.section {
    margin: 20px 30px;
}

.section-card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
}

.section-card h3 {
    color: #a78bfa;
    margin-bottom: 14px;
    font-size: 17px;
}

.section-desc {
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 16px;
}

/* BUTTONS */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: #7c3aed;
    color: white;
}

.btn-primary:hover {
    background-color: #6d28d9;
}

.btn-secondary {
    background-color: #21262d;
    color: #e6edf3;
    border: 1px solid #30363d;
}

.btn-secondary:hover {
    background-color: #30363d;
}

.btn-success {
    background-color: #3fb950;
    color: white;
}

.btn-success:hover {
    background-color: #2ea043;
}

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

.btn-danger:hover {
    background-color: #da3633;
}

.btn-google {
    background-color: #ffffff;
    color: #333333;
    font-size: 15px;
    padding: 14px 30px;
}

.btn-google:hover {
    background-color: #f0f0f0;
}

.btn-large {
    font-size: 16px;
    padding: 16px 40px;
}

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

.google-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* SOURCE OPTIONS */
.source-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.source-card {
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.source-card:hover {
    border-color: #7c3aed;
    background-color: #1a1e2e;
    transform: translateY(-2px);
}

.source-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.source-card h4 {
    color: #e6edf3;
    margin-bottom: 6px;
    font-size: 16px;
}

.source-card p {
    color: #484f58;
    font-size: 13px;
}

/* GMAIL SEARCH */
.gmail-search-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gmail-search-group input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    outline: none;
}

.gmail-search-group input[type="number"] {
    width: 100px;
    padding: 12px 16px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    outline: none;
}

.gmail-search-group input:focus {
    border-color: #7c3aed;
}

/* LOADED FILES */
.loaded-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.loaded-header h3 {
    margin-bottom: 0;
}

.loaded-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.loaded-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.loaded-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #30363d;
    background-color: #0d1117;
}

.loaded-item {
    position: relative;
}

.loaded-item .file-label {
    font-size: 11px;
    color: #484f58;
    margin-top: 4px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loaded-item .type-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background-color: rgba(0,0,0,0.7);
    color: #a78bfa;
}

/* PROGRESS BAR */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #0d1117;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: #8b949e;
}

.progress-detail {
    font-size: 12px;
    color: #484f58;
    margin-top: 4px;
}

/* NAMES LIST */
.names-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.name-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background-color: #1a1e2e;
    color: #a78bfa;
    border: 1px solid #7c3aed;
    display: flex;
    align-items: center;
    gap: 6px;
}

.name-badge .count {
    background-color: #7c3aed;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

/* RESULTS GRID */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-header h3 {
    margin-bottom: 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* FILE CARD */
.file-card {
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.file-card:hover {
    border-color: #7c3aed;
}

.file-card .preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #0d1117;
    display: block;
}

.file-card video.preview {
    height: 200px;
}

.file-card .card-body {
    padding: 16px;
}

.file-card .file-name {
    font-size: 13px;
    color: #8b949e;
    margin-bottom: 10px;
    word-break: break-all;
}

.file-card .detections {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detection-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.detection-tag.person {
    background-color: #1a3a2a;
    color: #3fb950;
    border: 1px solid #238636;
}

.detection-tag.object {
    background-color: #1a2332;
    color: #58a6ff;
    border: 1px solid #1f6feb;
}

.detection-tag.named {
    background-color: #2d1a4e;
    color: #a78bfa;
    border: 1px solid #7c3aed;
}

.detection-tag:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* DOWNLOAD BOX */
.download-box {
    text-align: center;
}

.download-box h3 {
    color: #3fb950 !important;
    font-size: 20px;
}

.download-box p {
    color: #8b949e;
    margin-bottom: 20px;
    font-size: 14px;
}

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    color: #a78bfa;
    margin-bottom: 20px;
    font-size: 18px;
}

.modal .crop-preview {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 16px;
    background-color: #0d1117;
    display: block;
}

.modal label {
    display: block;
    font-size: 14px;
    color: #8b949e;
    margin-bottom: 6px;
}

.modal input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}

.modal input[type="text"]:focus {
    border-color: #7c3aed;
}

.existing-names {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.existing-name-btn {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    background-color: #1a1e2e;
    color: #a78bfa;
    border: 1px solid #7c3aed;
    cursor: pointer;
    transition: all 0.2s ease;
}

.existing-name-btn:hover {
    background-color: #7c3aed;
    color: white;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background-color: #1a3a2a;
    color: #3fb950;
    border: 1px solid #238636;
}

.toast.error {
    background-color: #3a1a1a;
    color: #f85149;
    border: 1px solid #f85149;
}

.toast.info {
    background-color: #1a2332;
    color: #58a6ff;
    border: 1px solid #1f6feb;
}

/* SPINNER */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #30363d;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

::-webkit-scrollbar-track {
    background: #0d1117;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .header-right {
        align-items: center;
    }

    .section {
        margin: 12px 16px;
    }

    .source-options {
        grid-template-columns: 1fr;
    }

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

    .gmail-search-group {
        flex-direction: column;
    }

    .loaded-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}
