/* CSS Animations for visual appeal */
@keyframes active-glow {
    0% {
        box-shadow: 0 0 5px rgba(251, 191, 36, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    }
    100% {
        box-shadow: 0 0 5px rgba(251, 191, 36, 0.2);
    }
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes text-shine-animation {
    0% {
        background-position: -200% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}


@keyframes white-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
        border: 2px solid rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 1);
        border: 2px solid rgba(255, 255, 255, 1);
    }
}

@keyframes shine-effect {
    0% {
        transform: translateX(-100%) skewX(-25deg);
    }
    100% {
        transform: translateX(200%) skewX(-25deg);
    }
}


/* Variables for a consistent dark theme */
:root {
    --primary-bg: #111827;
    --secondary-bg: #1F2937;
    --tertiary-bg: #374151;
    --text-color: #E5E7EB;
    --primary-accent: #8B5CF6;
    --secondary-accent: #A78BFA;
    --highlight-accent: #FBBF24;
    --danger-color: #EF4444;
    --border-color: #4B5563;
}

/* Base styles for the body and overall layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Arial", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#original-content {
     padding: 70px 20px 20px 20px; /* Reduced top padding */
}

.site-header {
    position: fixed;
    top: 0;
    left: 20px; /* Aligned to the left */
    width: auto; /* Changed from 100% to auto */
    background-color: var(--primary-bg);
    padding: 15px 20px;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    display: flex;
    /* justify-content: space-between; -- Removed */
    align-items: center;
    border-radius: 0 0 12px 12px; /* Added rounded corners */
}


.logo-container {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    padding: 0;
    border-radius: 8px;
}

.header-logo {
    width: 40px;
    height: 40px;
}

h1 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 2em; /* Reduced from 2.5em */
    background: linear-gradient(90deg, var(--highlight-accent), var(--primary-accent), var(--secondary-accent), var(--highlight-accent));
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h1.animating {
    animation: gradient-animation 10s ease infinite;
}

h1.shine-once {
    animation: text-shine-animation 1.5s ease-in-out;
}

h2 {
    margin-top: 0;
}

.container {
    width: 100%;
    background-color: var(--secondary-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

#landing-container {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

#video-input-section {
    display: flex;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    overflow: hidden;
    
}

#video-input-section:focus-within {
    border-color: var(--primary-accent);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.input-icon {
    position: absolute;
    left: 15px;
    width: 20px;
    height: 20px;
    color: var(--border-color);
    transition: color 0.3s ease;
}

#video-input-section:focus-within .input-icon {
    color: var(--highlight-accent);
}

#video-url {
    flex-grow: 1;
    padding: 15px;
    padding-left: 50px;
    font-size: 16px;
    border: none;
    border-radius: 0;
    background-color: transparent;
    color: var(--text-color);
    outline: none;
}

#video-url:focus {
    box-shadow: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--primary-bg) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
}


button {
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-image: linear-gradient(to right, var(--primary-accent), var(--secondary-accent));
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s, opacity 0.3s;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: translateX(-150%) skewX(-25deg);
    transition: transform 0.85s ease;
}

button:hover::before {
    transform: translateX(250%) skewX(-25deg);
}

#load-video-btn {
    padding: 10px 20px;
    border-radius: 0;
    border-left: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

#video-input-section:focus-within #load-video-btn {
    border-left-color: var(--primary-accent);
}


button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background-image: none;
    background-color: var(--tertiary-bg);
}

#workspace {
    width: 100%;
    display: flex;
    gap: 10px;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.left-column {
    flex: 0 1 57.7077%;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    height: 85vh;
    min-height: 400px;
}

.right-column {
    flex: 0 1 42.2923%;
    background-color: var(--secondary-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    min-width: 250px;
    border: 1px solid var(--border-color);
    height: 79vh;
}

#player-container {
    position: relative;
    width: 100%;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    flex-grow: 1;
}

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

#add-bookmark-btn, #add-subtitle-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-size: 16px; /* Reduced font size */
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* --- START: DEFINITIVE LAYOUT FIX --- */

#bookmarks-header {
    display: flex;          /* Turns the header into a flexible container */
    flex-wrap: wrap;        /* Allows items to wrap onto multiple lines */
    align-items: center;    /* Vertically aligns the title and toggle */
    row-gap: 10px;          /* Adds vertical space between rows */
    flex-shrink: 0;
    margin-bottom: 10px;
}

#add-bookmark-btn, #undo-btn, #redo-btn {
    margin-top: 0px;
}

/* This rule targets the toggle container directly... */
#bookmarks-header > .autofill-toggle-container {
    margin-left: auto;      /* ...and pushes it all the way to the right. */
    padding-left: 20px;     /* Adds a small gap next to the title. */
}

/* This rule forces the main action buttons onto their own line below the title */
#bookmark-panel-controls, #subtitle-panel-controls, #undo-redo-controls {
    flex-basis: 100%;
}

/* --- END: DEFINITIVE LAYOUT FIX --- */


#bookmarks-title {
    font-size: 1.25rem;
}

#undo-redo-controls {
    display: flex;
    gap: 10px;
}

#undo-btn, #redo-btn {
    flex-grow: 1;
    padding: 8px;
    font-size: 14px;
    background-image: none;
    background-color: var(--tertiary-bg);
}

#bookmarks-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
    min-height: 0;
}

.bookmark-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background-color: var(--tertiary-bg);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

.bookmark-item.active-bookmark {
    border-color: var(--highlight-accent);
    animation: active-glow 2.5s ease-in-out infinite;
}

.bookmark-item.selected-subtitle {
    animation: white-glow 1.5s ease-in-out infinite;
}

.bookmark-counter {
    font-weight: bold;
    color: var(--secondary-accent);
    min-width: 20px;
    text-align: right;
}

.bookmark-item input, .bookmark-item textarea {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.bookmark-item input:focus, .bookmark-item textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
}

.bookmark-time {
    text-align: center;
    width: auto;
    min-width: 50px;
}

.bookmark-desc {
    flex-grow: 1;
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    min-height: 36px;
    box-sizing: border-box;
}

.delete-btn {
    background-image: linear-gradient(to right, var(--danger-color), #f87171);
    color: white;
    padding: 8px 12px;
    font-weight: bold;
}

.seek-btn {
    background: none;
    border: none;
    color: var(--secondary-accent);
    cursor: pointer;
    font-size: 18px;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.3s;
}
.seek-btn:hover {
    color: var(--primary-accent);
}
.seek-btn:focus {
    outline: none;
}

#speed-controls, #playback-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
}

#speed-controls {
    margin-bottom: 10px; /* Increased gap */
}

#playback-controls {
    margin-bottom: 2px;
}

.speed-btn, .seek-control-btn {
    background-color: var(--tertiary-bg);
    color: var(--text-color);
    padding: 8px 12px;
    font-size: 14px;
    background-image: none;
}
.speed-btn.active {
    background-image: linear-gradient(to right, var(--primary-accent), var(--secondary-accent));
    color: white;
}

#output-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#save-as-btn-container {
    position: relative;
}

#output-section textarea {
    width: 100%;
    height: 200px;
    margin-top: 10px;
    padding: 10px;
    box-sizing: border-box;
    background-color: var(--tertiary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
}

.save-as-dropdown {
    display: none;
    position: absolute;
    background-color: var(--secondary-bg);
    min-width: 120px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    top: 100%;
    left: 0;
    margin-top: 5px;
}

.save-as-dropdown.visible {
    display: block;
}

.save-as-dropdown a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.save-as-dropdown a:hover {
    background-color: var(--tertiary-bg);
}


.autofill-suggestions {
    position: absolute;
    background-color: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    z-index: 1000;
    max-height: 150px;
    overflow-y: auto;
}
.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
}
.suggestion-item:hover, .suggestion-item.active {
    background-color: var(--primary-accent);
    color: white;
}

#landing-page {
    text-align: center;
}

#tagline {
    font-family: inherit;
    font-weight: 400;
    font-size: 1.4em;
    color: var(--secondary-accent);
    text-shadow: 0 0 8px rgba(167, 139, 250, 0.3);
    letter-spacing: 0.5px;
    margin-top: 10px;
    margin-bottom: 40px;
}

.features-grid {
    margin: auto;
    height: 270px;
    width: 525px; /* Adjusted for 2 cards (240px) + gap (45px) */
    position: relative;
}

@media (max-width: 600px) {
    .features-grid {
        width: 240px;
    }
}

.feature-card {
    background-color: var(--tertiary-bg);
    padding: 20px;
    border-radius: 12px;
    box-sizing: border-box;
    width: 240px;
    height: 270px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(251, 191, 36, 0.2);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
    /* Animation properties */
    position: absolute;
    opacity: 0;
    will-change: transform, opacity;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    --translateX-offset: 0; /* Define variable for transform */
}

.feature-card:nth-of-type(1) {
    left: 0;
}

.feature-card:nth-of-type(2) {
    right: 0;
}


.feature-card:hover {
     border-color: rgba(251, 191, 36, 0.5);
     box-shadow: 0 0 25px rgba(251, 191, 36, 0.4);
     transform: translateX(var(--translateX-offset)) translateY(-5px); /* Use variable in hover */
}

.feature-card img {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
    flex-shrink: 0;
    filter: invert(48%) sepia(89%) saturate(2234%) hue-rotate(235deg) brightness(97%) contrast(97%);
}

.feature-card svg {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
    color: var(--primary-accent);
    flex-shrink: 0;
}

.feature-card h3 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 0.9em;
    margin: 0;
}

#start-over-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-image: none;
    background-color: var(--tertiary-bg);
}

.bookmarks-title-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.dropdown-arrow {
    font-size: 0.6em;
    margin-left: 8px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.bookmarks-title-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.bookmarks-dropdown {
    display: none;
    position: absolute;
    background-color: var(--secondary-bg);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.bookmarks-dropdown a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.bookmarks-dropdown a:hover {
    background-color: var(--tertiary-bg);
}

.bookmarks-title-container:hover .bookmarks-dropdown {
    display: block;
}

#timestamp-viewer {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-top: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

#current-time-display {
    font-family: 'Roboto Mono', monospace;
    font-size: 2em;
    font-weight: bold;
    color: var(--highlight-accent);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
    letter-spacing: 2px;
}

.subtitle-time-fields {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.subtitle-time {
    width: 100%;
}

#subtitle-controls {
    display: flex;
    gap: 10px;
}

#set-start-btn, #set-end-btn {
    flex-grow: 1;
}

#bookmark-panel-controls {
    margin-bottom: 10px;
}
#bookmark-panel-controls #add-bookmark-btn {
    width: 100%;
}

/* Media query for small mobile screens to prevent header overflow */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8em; /* Reduce font size */
    }
    .header-logo {
        width: 30px;
        height: 30px;
    }
    .logo-container {
        gap: 10px;
    }
}

/* --- START: FEEDBACK POP-UP STYLES --- */

#feedback-btn {
    margin-left: auto;
    background-image: none;
    background-color: var(--tertiary-bg);
    padding: 8px 16px;
    font-size: 14px;
    flex-shrink: 0;
}

#feedback-modal {
    display: none; /* The pop-up is hidden by default */
    position: fixed; /* This makes it float on top of the page content */
    z-index: 2000; /* This ensures it is in front of everything else */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7); /* This creates the dark, semi-transparent background */
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: var(--secondary-bg);
    margin: 10% auto; /* This centers the pop-up box on the screen */
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
}

.modal-close-btn {
    color: var(--border-color);
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: var(--text-color);
}

#feedback-form textarea, #feedback-form input[type="file"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    box-sizing: border-box;
    background-color: var(--primary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

#feedback-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--secondary-accent);
}

#feedback-submit-btn {
    width: 100%;
    padding: 12px;
}

#feedback-status {
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
}

/* In style.css */

#site-footer {
    position: fixed;
    bottom: 1px;
    /* Use left and right to span the full width */
    left: 0;
    right: 0;
    z-index: 1002;
    
    /* Use Flexbox to center the text content */
    display: flex;
    justify-content: center;

    /* Original text styling */
    color: var(--border-color);
    font-size: 0.8em;
}

