/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
}

body, html {
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;
    background-color: #1e1e1e;
    color: #fff;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Remove all margins and padding in hidden interface mode */
body.interface-hidden {
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrolling */
    height: 100vh; /* Full viewport height */
}

/* Logo styles */
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.logo, .footer-logo {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 6px;
    background: linear-gradient(90deg, #0e2d61 0%, #0d47a1 100%);
    display: inline-block;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
}

.logo:hover {
    transform: translateY(-2px);
}

.logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
}

.logo:hover::after {
    left: 100%;
}

.logo-free {
    color: #ffcc00;
    font-weight: 900;
}

.logo-teleprompt {
    color: #ffffff;
}

.logo-com {
    color: #7bb4ff;
    font-size: 0.8em;
    font-weight: 400;
}

.footer-logo {
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: inline-block;
}

/* SEO Header and Footer */
.seo-header {
    background-color: #0d47a1;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.seo-header p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto 15px;
}

/* Header Navigation */
.header-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.header-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-nav a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffcc00;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.seo-footer {
    background-color: #222;
    padding: 20px;
    text-align: center;
    margin-top: auto; /* Push footer to bottom */
    border-top: 1px solid #444;
    flex-shrink: 0; /* Prevent shrinking */
}

.seo-footer p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #bbb;
}

/* Explanatory Section Styling */
.explanatory-section {
    padding: 30px 20px;
    background-color: #2d2d2d;
    margin-bottom: 30px;
}

.explanatory-content {
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
    padding: 25px 30px;
    background-color: #333;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.explanatory-content h2 {
    font-size: 1.4rem;
    color: #5e9eff;
    margin-bottom: 15px;
}

.explanatory-content h3 {
    font-size: 1.2rem;
    color: #5e9eff;
    margin: 20px 0 10px;
}

.explanatory-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #ddd;
    margin-bottom: 15px;
}

.explanatory-content .features-list {
    list-style-type: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    overflow: visible;
}

.features-list {
    list-style-type: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    overflow: visible;
}

.features-list li {
    padding: 8px 0;
    color: #ccc;
    font-size: 0.9rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.features-list li strong {
    color: #7bb4ff;
    display: inline-block;
}

.cta-links {
    text-align: center;
    margin: 25px 0 10px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

.cta-links a {
    color: #5e9eff;
    text-decoration: none;
    margin: 0 5px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cta-links a:hover {
    color: #7bb4ff;
    text-decoration: underline;
}

/* Hide footer content in fullscreen mode */
.interface-hidden .footer-content {
    display: none;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 400px; /* Use fixed minimum height instead */
    max-height: 60vh; /* Maximum height to prevent overflow */
    background-color: #1e1e1e;
    color: #fff;
    position: relative;
    margin-bottom: 30px; /* Add margin at bottom */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Control panel styles */
.control-panel {
    padding: 15px;
    background-color: #2d2d2d;
    border-bottom: 1px solid #444;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    /* Remove height limit and scrolling */
}

.control-panel h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    text-align: center;
    color: #5e9eff;
}

.upload-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.upload-section, .text-input-section {
    flex: 1;
    min-width: 280px;
}

.file-upload-label {
    display: block;
    padding: 12px;
    background-color: #4a4a4a;
    color: white;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background-color 0.2s ease;
}

.file-upload-label:hover {
    background-color: #5d5d5d;
}

#fileUpload {
    display: none;
}

textarea {
    width: 100%;
    height: 80px; /* Reduced height */
    background-color: #3a3a3a;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 10px;
    margin-top: 8px;
    margin-bottom: 8px;
    resize: vertical;
    font-size: 16px;
}

.button {
    padding: 10px 18px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.button:hover {
    background-color: #0069d9;
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(1px);
}

.button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.speed-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-controls label {
    min-width: 100px;
}

.speed-controls input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: #555;
    border-radius: 3px;
    outline: none;
}

.speed-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
}

.speed-controls input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.playback-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.interface-buttons {
    display: flex;
    justify-content: center;
}

.primary-button {
    background-color: #28a745;
}

.primary-button:hover {
    background-color: #218838;
}

.fullscreen-button {
    background-color: #6c757d;
    width: 100%;
    max-width: 300px;
    margin: 5px auto;
}

.fullscreen-button:hover {
    background-color: #5a6268;
}

.quick-instructions {
    margin-top: 10px;
    padding: 8px;
    background-color: #3a3a3a;
    border-radius: 4px;
    text-align: center;
    border-left: 4px solid #007bff;
}

.quick-instructions p {
    font-size: 0.9rem;
    margin: 0;
    color: #ccc;
}

.quick-instructions .note {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 4px;
    font-style: italic;
}

/* Show/Hide Interface buttons */
.show-interface-button {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000; /* Ensure it's above everything */
    padding: 8px 12px;
    background-color: rgba(0, 123, 255, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.show-interface-button:hover {
    background-color: rgba(0, 123, 255, 0.9);
    transform: translateY(-1px);
}

.show-interface-button:active {
    transform: translateY(1px);
}

/* Adjust positioning in hidden mode */
.interface-hidden .show-interface-button {
    position: fixed; /* Fixed position relative to viewport */
    top: 10px;
    right: 10px;
}

/* Teleprompter display styles */
.teleprompter-container {
    flex: 1;
    display: flex;
    flex-direction: row; /* Changed to row to support side margins for ads */
    justify-content: center;
    align-items: stretch; /* Make items stretch to fill container */
    position: relative;
    overflow: hidden;
    background-color: #000;
    min-height: 400px;
    height: 100%; /* Take full height of parent */
}

/* Side margins for ads */
.teleprompter-ad-left,
.teleprompter-ad-right {
    width: 15%; /* Width for ad space */
    background-color: rgba(0, 0, 0, 0.3); /* Semi-transparent background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
}

/* Ad container styles */
.ad-container-vertical {
    width: 100%;
    height: 100%;
    min-height: 400px;
    max-width: 160px;
    margin: 0 auto;
}

.teleprompter-display-wrapper {
    position: relative;
    width: 70%; /* Take remaining space between ad margins */
    height: 100%;
    overflow: hidden;
}

.teleprompter-display {
    width: 100%;
    height: 100%; /* Take full height of parent */
    min-height: 400px; /* Ensure minimum height */
    overflow: hidden;
    position: relative;
    background-color: #000; /* Match container color */
}

/* Class for loaded text */
.text-ready {
    /* Styles can be added here when needed */
}

.teleprompter-text {
    position: absolute;
    width: 100%;
    text-align: center;
    padding: 0 5%; /* Reduced padding to use more horizontal space */
    transition: transform 0.1s linear;
    min-height: 100px; /* Ensure the container has minimum height */
    display: block; /* Make sure it's displayed as a block element */
}

.teleprompter-text p {
    font-size: 38px; /* Increased font size for better readability */
    line-height: 1.6;
    margin-bottom: 25px;
    color: #fff;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Larger text when in full-screen hidden mode */
.interface-hidden .teleprompter-text p {
    font-size: 42px;
    line-height: 1.7;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
}

/* Position indicator */
.position-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10; /* Make sure it's above text */
}

.center-marker {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 3px; /* Slightly thicker */
    background-color: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.9);
}

/* Add triangles at the ends of the center marker */
.center-marker::before,
.center-marker::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.center-marker::before {
    left: 5px;
    top: -5px;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent rgba(255, 0, 0, 0.8);
}

.center-marker::after {
    right: 5px;
    top: -5px;
    border-width: 6px 10px 6px 0;
    border-color: transparent rgba(255, 0, 0, 0.8) transparent transparent;
}

/* Hidden interface mode styles */
.interface-hidden .control-panel {
    display: none;
}

.interface-hidden .show-interface-button {
    display: block;
}

.interface-hidden .seo-header,
.interface-hidden .seo-footer,
.interface-hidden .explanatory-section {
    display: none;
}

/* Make the app container take full viewport height when interface is hidden */
.interface-hidden .app-container {
    height: 100vh;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Make teleprompter container take full height in hidden mode */
.interface-hidden .teleprompter-container {
    height: 100vh;
    min-height: 100vh;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }
    
    .seo-header p {
        font-size: 1rem;
    }
    
    .header-nav {
        gap: 12px;
        margin-top: 12px;
    }
    
    .header-nav a {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .app-container {
        min-height: 350px;
        max-height: 55vh;
        margin-bottom: 20px;
    }
    
    .upload-container {
        flex-direction: column;
    }
    
    .teleprompter-text {
        padding: 0 5%;
    }
    
    .teleprompter-text p {
        font-size: 28px;
    }
    
    .interface-hidden .teleprompter-text p {
        font-size: 32px;
    }
    
    .button {
        padding: 12px 16px;
        font-size: 16px;
        width: 100%;
    }
    
    /* Explanatory section adjustments */
    .explanatory-section {
        padding: 25px 15px;
        margin-bottom: 20px;
    }
    
    .explanatory-content {
        padding: 20px;
    }
    
    .features-list {
        grid-template-columns: 1fr;
    }
    
    /* Adjust ad spaces for smaller screens */
    .teleprompter-ad-left,
    .teleprompter-ad-right {
        width: 10%;
    }
    
    .teleprompter-display-wrapper {
        width: 80%;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .header-nav {
        gap: 8px;
        margin-top: 10px;
    }
    
    .header-nav a {
        font-size: 0.8rem;
        padding: 5px 8px;
    }
    
    /* Hide ad spaces on very small screens */
    .teleprompter-ad-left,
    .teleprompter-ad-right {
        display: none;
    }
    
    .teleprompter-display-wrapper {
        width: 100%;
    }
    
    .app-container {
        min-height: 300px;
        max-height: 50vh;
        margin-bottom: 15px;
    }
    
    .control-panel {
        max-height: 40vh;
    }
    
    .teleprompter-text p {
        font-size: 24px;
        line-height: 1.4;
        margin-bottom: 15px;
    }
    
    /* Further adjust explanatory section for very small screens */
    .explanatory-section {
        padding: 15px 10px;
        margin-bottom: 15px;
    }
    
    .explanatory-content {
        padding: 15px;
        border-radius: 6px;
    }
    
    .explanatory-content h2 {
        font-size: 1.3rem;
    }
    
    .explanatory-content h3 {
        font-size: 1.1rem;
    }
    
    .explanatory-content p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Schema.org structured data styling */
.schema-data {
    display: none;
}

/* Consent notice styling */
.fc-consent-root {
    z-index: 9999 !important; /* Ensure it appears above all other elements */
}

/* Make sure the consent dialog doesn't interfere with fullscreen mode */
.interface-hidden .fc-consent-root {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
}