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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    transition: background 0.3s ease;
}

body.dark {
    background: #0a0a0a;
    color: #e5e5e5;
}

.container {
    text-align: center;
    width: 90%;
    max-width: 600px;
    padding: 2rem;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.theme-toggle {
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1a1a1a;
    transition: all 0.2s ease;
    opacity: 0.6;
}

body.dark .theme-toggle {
    border-color: #333;
    color: #e5e5e5;
}

.theme-toggle:hover {
    opacity: 1;
    transform: rotate(15deg) scale(1.05);
    background: rgba(0, 0, 0, 0.05);
}

body.dark .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.theme-toggle:active {
    transform: rotate(0deg) scale(0.95);
}

.time {
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
    opacity: 0.9;
    user-select: none;
}

.greeting {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 3rem;
    opacity: 0.7;
    user-select: none;
}

.search-form {
    margin-bottom: 3rem;
    position: relative;
}

.search-form input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

body.dark .search-form input {
    border-color: #333;
}

.search-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.engine-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.search-form input:focus {
    border-color: #1a1a1a;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.dark .search-form input:focus {
    border-color: #e5e5e5;
    background: #1a1a1a;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05);
}

.search-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.engine-selector, .settings-btn {
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    opacity: 0.7;
}

body.dark .engine-selector,
body.dark .settings-btn {
    border-color: #333;
}

.engine-selector:hover, .settings-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

body.dark .engine-selector:hover,
body.dark .settings-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.engine-selector svg, .settings-btn svg {
    transition: transform 0.2s ease;
}

.engine-selector:hover svg {
    transform: rotate(180deg);
}

.settings-btn:hover svg {
    transform: rotate(45deg);
}

body.dark .engine-dropdown {
    background: #1a1a1a;
    border-color: #333;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.engine-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.engine-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

body.dark .engine-item {
    border-color: #2a2a2a;
}

.engine-item:last-child {
    border-bottom: none;
}

.engine-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

body.dark .engine-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.engine-item.active {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

body.dark .engine-item.active {
    background: rgba(255, 255, 255, 0.08);
}

.check {
    color: #4CAF50;
    font-weight: bold;
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    padding: 1rem;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

body.dark .modal-content {
    background: #1a1a1a;
    color: #e5e5e5;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark .modal-header {
    border-color: #2a2a2a;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

body.dark .close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.add-engine-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

body.dark .add-engine-form {
    border-color: #2a2a2a;
}

.add-engine-form input {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    background: transparent;
    color: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

body.dark .add-engine-form input {
    border-color: #333;
}

.add-engine-form input:focus {
    border-color: #1a1a1a;
}

body.dark .add-engine-form input:focus {
    border-color: #e5e5e5;
}

.add-engine-form button {
    padding: 0.75rem;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.dark .add-engine-form button {
    background: #e5e5e5;
    color: #1a1a1a;
}

.add-engine-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.engine-manage-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    gap: 1rem;
}

body.dark .manage-item {
    background: rgba(255, 255, 255, 0.03);
}

.engine-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.engine-info strong {
    font-size: 0.95rem;
}

.engine-info .url {
    font-size: 0.75rem;
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.engine-actions {
    display: flex;
    gap: 0.5rem;
}

.default-badge {
    background: #4CAF50;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

/* Scrollbar styling */
.engine-dropdown::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.engine-dropdown::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.engine-dropdown::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

body.dark .engine-dropdown::-webkit-scrollbar-thumb,
body.dark .modal-body::-webkit-scrollbar-thumb {
    background: #444;
}

/* Quote */
.quote {
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.5;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Modal Actions (Restore buttons) */
.modal-actions {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 2px solid #f0f0f0;
}

body.dark .modal-actions {
    border-color: #2a2a2a;
}

.restore-btn {
    background: transparent;
    border: 2px solid #e0e0e0;
    color: inherit;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
}

body.dark .restore-btn {
    border-color: #333;
}

.restore-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

body.dark .restore-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 600px) {
    .time {
        font-size: 3rem;
    }

    .greeting {
        font-size: 1.2rem;
    }
}