/* Search Results Modern Styling */

/* Base Styles */
:root {
    --primary-color: #057940;
    --primary-hover: #046835;
    --secondary-color: #424242;
    --accent-color: #ff9800;
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-light: #f5f5f5;
    --bg-light: #f5f5f5;
    --card-bg: #ffffff;
    --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    --card-border-radius: 16px;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.modern-search-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Loading Overlay */
.overlay-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loader-content {
    text-align: center;
    color: white;
}

/* Search Container */
.search-container {
    padding: 30px 0;
}

.search-card {
    background-color: var(--card-bg);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    padding: 25px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

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

.search-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.logo-container {
    width: 120px;
    height: auto;
}

.custom-logo {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.search-form {
    width: 100%;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
    margin-bottom: 15px;
}

.form-group {
    position: relative;
    padding-right: 10px;
    padding-left: 10px;
    margin-bottom: 15px;
}

/* Floating label inputs */
.floating-input {
    position: relative;
}

    .floating-input input,
    .floating-input select {
        height: 50px;
        width: 100%;
        border: 1px solid #ddd;
        border-radius: 10px;
        padding: 0 15px;
        font-size: 16px;
        background: white;
        transition: all var(--transition-speed);
    }

        .floating-input input:focus,
        .floating-input select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(5, 121, 64, 0.2);
            outline: none;
        }

    .floating-input label {
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        color: #999;
        padding: 0 5px;
        background: white; /* Garante contraste */
        transition: all var(--transition-speed);
        pointer-events: none;
        z-index: 10;
    }

    /* Quando o input/select estiver com foco ou com valor, reposicionar o label acima */
    .floating-input input:focus ~ label,
    .floating-input input:not(:placeholder-shown) ~ label,
    .floating-input select:focus ~ label,
    .floating-input select:not([value=""]) ~ label {
        top: -10px; /* Ajuste conforme necessário */
        transform: none;
        font-size: 12px;
        color: var(--primary-color);
    }

/* Search button */
.search-button {
    width: 100%;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

    .search-button:hover {
        background-color: var(--primary-hover);
    }

    .search-button i {
        font-size: 18px;
    }

/* Results Container */
.results-container {
    flex: 1;
    padding: 20px 0 60px;
}

.results-summary {
    margin-bottom: 30px;
    text-align: center;
}

.results-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.results-count {
    color: var(--primary-color);
    font-weight: 700;
}

.no-results {
    padding: 40px 0;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

    .empty-state i {
        color: var(--primary-color);
        margin-bottom: 20px;
    }

    .empty-state h3 {
        margin-bottom: 10px;
        font-weight: 600;
    }

/* Camera Groups */
.camera-groups {
    margin-bottom: 30px;
}

.camera-group {
    margin-bottom: 20px;
    background: white;
    border-radius: var(--card-border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.camera-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

    .camera-header:hover {
        background: linear-gradient(to right, #e9ecef, #dee2e6);
    }

.camera-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

    .camera-title i {
        margin-right: 10px;
        color: var(--primary-color);
    }

.video-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 10px;
    font-weight: 400;
}

.toggle-icon {
    transition: transform var(--transition-speed);
}

.camera-header[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.camera-content {
    padding: 20px;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Video Card */
.video-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

    .video-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
    }

    /* Video orientation handling */
    .video-card.portrait .video-player-container {
        aspect-ratio: 9/16;
    }

    .video-card.landscape .video-player-container {
        aspect-ratio: 16/9;
    }

.video-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background-color: rgba(255, 255, 255, 0.95);
}

.video-time {
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    font-weight: 800;
    align-items: center;
}

.camera-name {
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    font-weight: 800;
    align-items: end;
}

    .video-time i {
        margin-right: 5px;
    }

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

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: #f8f9fa;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .action-btn:hover {
        background-color: var(--primary-color);
        color: white;
        transform: scale(1.1);
    }

.share-btn:hover {
    background-color: #3b5998;
}

.download-btn:hover {
    background-color: var(--primary-color);
    color: white !important;
}

.download-section {
    margin: auto;
    padding: 10px 0px 10px 0px;
    text-align: center;
}

.retry-btn:hover {
    background-color: #f44336;
}

.video-player-container {
    position: relative;
    width: 100%;
    background-color: #000;
    overflow: hidden;
}

.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player-container:hover .video-overlay {
    opacity: 1;
}

.play-icon i {
    color: white;
    font-size: 50px;
    opacity: 0.8;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.video-player-container:hover .play-icon i {
    transform: scale(1.2);
    opacity: 1;
}

/* Error and Processing Cards */
.error-card, .processing-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.error-content, .processing-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16/9;
    background-color: rgba(0, 0, 0, 0.03);
    position: relative;
}

.error-animation, .processing-animation {
    max-height: 80%;
    max-width: 80%;
    object-fit: contain;
}

.error-message, .processing-status {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.error-message {
    color: #f44336;
    font-weight: 500;
}


.danger-message {
    color: darkorange;
    font-weight: 500;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 30px;
    background-color: rgba(5, 121, 64, 0.1);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 500;
}

    .status-badge i {
        margin-right: 5px;
    }

/* Progress Bar */
.progress {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
}

/* Footer */
.app-footer {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

    .app-footer p {
        margin: 0;
    }

    .app-footer span {
        font-weight: bold;
    }

/* Media Queries */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }

    .search-card, .camera-group {
        border-radius: 12px;
    }
}

@media (max-width: 576px) {
    .video-grid {
        grid-template-columns: 1fr;
    }

    .video-card {
        max-width: 100%;
    }

    .search-container, .results-container {
        padding: 15px 0;
    }
}
