/* ============================================
   FLASHY MODERN META AI AUTOMATION DASHBOARD
   ============================================ */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --glow-color: rgba(102, 126, 234, 0.6);
    --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.25);
}

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

body {
    font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

/* Animated Background Particles */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(
            circle at 20% 50%,
            rgba(255, 255, 255, 0.1) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 80%,
            rgba(255, 255, 255, 0.15) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 40% 20%,
            rgba(255, 255, 255, 0.1) 0%,
            transparent 50%
        );
    animation: particleFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particleFloat {
    0%,
    100% {
        opacity: 1;
        transform: translateY(0px);
    }
    50% {
        opacity: 0.5;
        transform: translateY(-20px);
    }
}

.container {
    position: relative;
    z-index: 1;
}

/* ============================================
   NAVBAR - Glassmorphism Style
   ============================================ */
.navbar {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.8rem;
    color: #fff !important;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

.navbar-brand i {
    animation: robotBounce 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes robotBounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem !important;
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #fff, transparent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link:hover {
    color: #fff !important;
    transform: translateY(-2px);
}

/* ============================================
   CARDS - Glassmorphism with Animations
   ============================================ */
.card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}
.card:nth-child(2) {
    animation-delay: 0.2s;
}
.card:nth-child(3) {
    animation-delay: 0.3s;
}
.card:nth-child(4) {
    animation-delay: 0.4s;
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.card-header {
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 700;
    font-size: 1.3rem;
    padding: 1.2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.card-header h3 {
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.card-body {
    padding: 1.5rem;
    color: #fff;
}

/* ============================================
   STAT CARDS - Vibrant Gradients
   ============================================ */
.card.text-white {
    position: relative;
    overflow: hidden;
    border: none;
    transition: all 0.4s ease;
}

.card.text-white::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 70%
    );
    animation: rotate 10s linear infinite;
}

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

.card.bg-success {
    background: var(--success-gradient) !important;
    box-shadow: 0 10px 40px rgba(17, 153, 142, 0.4);
}

.card.bg-success:hover {
    box-shadow: 0 15px 60px rgba(17, 153, 142, 0.6);
    transform: translateY(-5px) scale(1.05);
}

.card.bg-danger {
    background: var(--danger-gradient) !important;
    box-shadow: 0 10px 40px rgba(235, 51, 73, 0.4);
}

.card.bg-danger:hover {
    box-shadow: 0 15px 60px rgba(235, 51, 73, 0.6);
    transform: translateY(-5px) scale(1.05);
}

.card.bg-info {
    background: var(--info-gradient) !important;
    box-shadow: 0 10px 40px rgba(79, 172, 254, 0.4);
}

.card.bg-info:hover {
    box-shadow: 0 15px 60px rgba(79, 172, 254, 0.6);
    transform: translateY(-5px) scale(1.05);
}

.card.bg-secondary {
    background: var(--dark-gradient) !important;
    box-shadow: 0 10px 40px rgba(44, 62, 80, 0.4);
}

.card.bg-secondary:hover {
    box-shadow: 0 15px 60px rgba(44, 62, 80, 0.6);
    transform: translateY(-5px) scale(1.05);
}

/* Filter cards - clickable state */
.card.bg-success,
.card.bg-danger,
.card.bg-info {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

/* Active filter state */
.card.filter-active {
    transform: translateY(-5px) scale(1.05) !important;
    opacity: 1 !important;
    border: 3px solid rgba(255, 255, 255, 0.8);
}

/* Inactive filter state */
.card.filter-inactive {
    opacity: 0.6;
    transform: scale(1);
}

.card.text-white .card-body {
    position: relative;
    z-index: 1;
}

.card.text-white .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card.text-white h2 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: numberPulse 2s ease-in-out infinite;
}

@keyframes numberPulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ============================================
   BUTTONS - Neon Glow Effect
   ============================================ */
.btn {
    padding: 0.8rem 2rem;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition:
        width 0.6s,
        height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(-1px) scale(1.02);
}

.btn-success {
    background: var(--success-gradient);
    color: #fff;
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.4);
}

.btn-success:hover {
    box-shadow: 0 10px 40px rgba(17, 153, 142, 0.6);
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--danger-gradient);
    color: #fff;
    box-shadow: 0 5px 20px rgba(235, 51, 73, 0.4);
}

.btn-danger:hover {
    box-shadow: 0 10px 40px rgba(235, 51, 73, 0.6);
    filter: brightness(1.1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.6);
    filter: brightness(1.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn i {
    margin-right: 0.5rem;
}

/* ============================================
   STATUS INDICATORS
   ============================================ */
.status-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
    animation: statusBlink 2s ease-in-out infinite;
    box-shadow: 0 0 10px currentColor;
}

@keyframes statusBlink {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 10px currentColor;
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 20px currentColor;
    }
}

.status-running {
    background-color: #38ef7d;
    box-shadow: 0 0 20px #38ef7d;
}

.status-stopped {
    background-color: #f45c43;
    box-shadow: 0 0 20px #f45c43;
}

/* ============================================
   SCREENSHOT CONTAINERS
   ============================================ */
.screenshot-container {
    max-width: 250px;
    max-height: 250px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screenshot badge for showing image number */
.screenshot-container .screenshot-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
}

.screenshot-container .screenshot-badge .badge {
    font-size: 0.9rem;
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.8) !important;
}

.screenshot-container:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

.screenshot-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.3s ease;
    filter: brightness(0.95);
}

.screenshot-container:hover img {
    filter: brightness(1.1);
    transform: scale(1.1);
}

/* Latest analysis screenshot - full height */
#latest-analysis .screenshot-container {
    max-width: 100%;
    max-height: none;
    height: auto;
    min-height: 600px;
}

#latest-analysis .screenshot-container img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
}

#latest-analysis .screenshot-container img.screenshot-fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* History table screenshot - square with vertical centering */
.table .screenshot-container {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
}

.table .screenshot-container img {
    object-fit: cover;
    object-position: center;
}

/* ============================================
   TABLES - Modern Styling
   ============================================ */
.table-responsive {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.table {
    margin-bottom: 0;
    color: #fff;
}

/* Override Bootstrap striped rows to maintain color scheme */
.table-striped > tbody > tr:nth-of-type(odd) > * {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.table-striped > tbody > tr:nth-of-type(even) > * {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.02);
}

.table thead {
    background: rgba(0, 0, 0, 0.3);
}

.table thead th {
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem;
    font-size: 0.9rem;
    color: #fff;
}

.table tbody tr {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    color: #fff;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.01);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border: none;
    color: #fff;
}

.table a {
    color: #4facfe;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

.table a:hover {
    color: #00f2fe;
    text-shadow: 0 0 10px rgba(79, 172, 254, 0.5);
}

/* ============================================
   TOOLTIP
   .custom-tooltip {
     --bs-tooltip-bg: var(--bs-primary);
     --bs-tooltip-color: var(--bs-white);
   }

   PAGINATION
   ============================================ */
.pagination {
    margin-top: 2rem;
}

.page-item .page-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    margin: 0 0.2rem;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.page-item .page-link:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

/* ============================================
   MODAL - Glassmorphism
   ============================================ */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
}

.modal-header {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    padding: 1.5rem;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.5rem;
}

.modal-header .btn-close {
    filter: invert(1);
    opacity: 1;
}

.modal-body {
    padding: 2rem;
    color: #333;
}

.modal-body img {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    height: auto;
    object-fit: contain;
}

.modal-body .bg-light {
    background: rgba(102, 126, 234, 0.1) !important;
    border-left: 4px solid #667eea;
    color: #333 !important;
    line-height: 1.6;
    font-style: italic;
}

.modal-body .bg-light strong {
    color: #222;
    font-weight: 700;
}

.modal-body .bg-light em {
    color: #555;
    font-style: italic;
}

.modal-body .bg-light code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: #d63384;
    font-family: "Courier New", monospace;
    font-style: normal;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner-border {
    width: 4rem;
    height: 4rem;
    border-width: 0.4em;
    border-color: rgba(255, 255, 255, 0.3);
    border-right-color: #fff;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border: none;
    border-radius: 15px;
    padding: 1.2rem;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.alert-danger {
    background: var(--danger-gradient);
    color: #fff;
}

.alert-success {
    background: var(--success-gradient);
    color: #fff;
}

.alert-info {
    background: var(--info-gradient);
    color: #fff;
}

/* ============================================
   TEXT UTILITIES
   ============================================ */
.text-success {
    color: #38ef7d !important;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(56, 239, 125, 0.5);
}

.text-danger {
    color: #f45c43 !important;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(244, 92, 67, 0.5);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2, #667eea);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.3rem;
    }

    .card {
        margin-bottom: 1.5rem;
    }

    .card-header h3 {
        font-size: 1.1rem;
    }

    .card.text-white h2 {
        font-size: 2rem;
    }

    .btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }

    .screenshot-container {
        max-width: 150px;
        max-height: 150px;
    }

    .table {
        font-size: 0.85rem;
    }

    .table td,
    .table th {
        padding: 0.75rem;
    }
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */
@keyframes float {
    0%,
    100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Glow effect for important elements */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow:
            0 0 10px rgba(102, 126, 234, 0.5),
            0 0 20px rgba(102, 126, 234, 0.3),
            0 0 30px rgba(102, 126, 234, 0.2);
    }
    to {
        box-shadow:
            0 0 20px rgba(102, 126, 234, 0.8),
            0 0 30px rgba(102, 126, 234, 0.5),
            0 0 40px rgba(102, 126, 234, 0.3);
    }
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

/* Latest analysis special styling */
#latest-analysis {
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#latest-analysis .bg-light {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #333 !important;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    font-style: italic;
    line-height: 1.6;
    min-height: 100px;
}

#latest-analysis .bg-light strong {
    color: #222;
}

#latest-analysis .bg-light em {
    color: #555;
}

#latest-analysis .bg-light code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: #d63384;
    font-family: "Courier New", monospace;
}

/* Loading spinner in analysis */
.analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.analysis-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

.analysis-loading p {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

/* New entry animation */
.new-entry {
    animation: highlightNew 2s ease-out;
}

@keyframes highlightNew {
    0% {
        background: rgba(102, 126, 234, 0.5);
        transform: translateX(-20px);
        opacity: 0;
    }
    50% {
        background: rgba(102, 126, 234, 0.3);
    }
    100% {
        background: transparent;
        transform: translateX(0);
        opacity: 1;
    }
}

/* New video notification toast */
.new-video-notification {
    position: fixed;
    top: 80px;
    right: -300px;
    background: var(--success-gradient);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    z-index: 9999;
    transition: right 0.3s ease-out;
}

.new-video-notification.show {
    right: 20px;
}

.new-video-notification i {
    font-size: 1.5rem;
    animation: checkBounce 0.5s ease-out;
}

@keyframes checkBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}
