* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff8c00 0%, #ff6347 100%);
    min-height: 100vh;
    color: #333;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #e0e0e0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-text {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.theme-toggle-checkbox {
    display: none;
}

.theme-toggle-label {
    position: relative;
    display: block;
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.theme-toggle-label:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle-inner {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle-inner {
    transform: translateX(24px);
}

.theme-toggle-switch {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 14px;
    height: 14px;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    transition: all 0.3s ease;
}

.theme-toggle-switch::before {
    content: '☀️';
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle-switch {
    transform: translateX(24px);
}

.theme-toggle-checkbox:checked + .theme-toggle-label .theme-toggle-switch::before {
    content: '🌙';
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 15px;
    align-items: center;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    border-color: #667eea;
}

#searchInput::placeholder {
    color: #666;
}

#searchBtn {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #ff8c00 0%, #ff6347 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 140, 0, 0.4);
}

.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.results-section h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8rem;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.movie-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid transparent;
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.movie-card.selected {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

body.dark-mode .movie-card {
    background: #1a1a1a;
    border: 3px solid #404040;
}

body.dark-mode .movie-card:hover {
    border-color: #606060;
}

body.dark-mode .movie-card.selected {
    border-color: #ff8c00;
}

.movie-poster {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.movie-info {
    padding: 15px;
}

.movie-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1rem;
    line-height: 1.3;
    color: #2d2d2d;
}

body.dark-mode .movie-title {
    color: #e0e0e0;
}

.movie-year {
    color: #666;
    font-size: 0.9rem;
}

body.dark-mode .movie-year {
    color: #aaa;
}

.selected-movie {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.selected-movie h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8rem;
}

body.dark-mode .selected-movie {
    background: #2a2a2a;
    border: 1px solid #404040;
}

body.dark-mode .selected-movie h2 {
    color: #e0e0e0;
}

.movie-title-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.formatted-title {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px dashed #ff8c00;
    border-radius: 10px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #2d2d2d;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: pre-line;
    line-height: 1.5;
}

body.dark-mode .formatted-title {
    background: #1a1a1a;
    border: 2px dashed #ff8c00;
    color: #e0e0e0;
    white-space: pre-line;
    line-height: 1.5;
}

.copy-btn {
    padding: 15px 25px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.success-message {
    margin-top: 15px;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
    font-weight: bold;
}

body.dark-mode .success-message {
    background: #1a4a1a;
    border: 1px solid #2a6a2a;
    color: #4ade80;
}

.api-info {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-align: center;
}

body.dark-mode .api-info {
    background: rgba(42, 42, 42, 0.8);
    border: 1px solid rgba(64, 64, 64, 0.5);
}

.api-info a {
    color: #ffd700;
    text-decoration: none;
}

.api-info a:hover {
    text-decoration: underline;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2rem;
}

body.dark-mode .no-results {
    color: #aaa;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    color: #721c24;
    margin-bottom: 20px;
}

body.dark-mode .error-message {
    background: #4a1a1a;
    border: 1px solid #6a2a2a;
    color: #ff6b6b;
}

.search-type-toggle {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.toggle-buttons {
    display: flex;
    background: #f0f0f0;
    border-radius: 25px;
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #666;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6347 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 140, 0, 0.1);
    color: #ff8c00;
}

body.dark-mode .toggle-buttons {
    background: #1a1a1a;
}

body.dark-mode .toggle-btn {
    color: #e0e0e0;
}

body.dark-mode .toggle-btn:hover:not(.active) {
    background: rgba(255, 140, 0, 0.2);
    color: #ff8c00;
}

.logo-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.re-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-radius: 8px;
}

.re-logo:hover {
    opacity: 1;
    transform: scale(1.1);
}

.result-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.result-section h3 {
    margin: 0 0 15px 0;
    color: #2d2d2d;
    font-size: 1.2rem;
    text-shadow: none;
    font-weight: 600;
}

body.dark-mode .result-section {
    background: rgba(42, 42, 42, 0.8);
    border: 1px solid rgba(64, 64, 64, 0.5);
}

body.dark-mode .result-section h3 {
    color: #e0e0e0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .movie-title-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .formatted-title {
        min-width: auto;
    }
    
    .logo-container {
        bottom: 15px;
        left: 15px;
    }
    
    .re-logo {
        width: 50px;
        height: 50px;
    }
}
