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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #4285f4 0%, #ffffff 50%, #1a73e8 100%);
    min-height: 100vh;
    direction: ltr;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 60px;
    position: relative;
    width: 100%;
}

.logo {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: -0.8px;
}

.logo-sea {
    color: #1a73e8;
}

.logo-search {
    color: #e8eaed;
}

.user-section {
    margin-left: auto;
}

.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-section span {
    color: #1a73e8;
    font-weight: 500;
    font-size: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: #4285f4;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 120px;
    display: none;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.logout-btn {
    background-color: #ea4335;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
    width: 100%;
}

.logout-btn:hover {
    background-color: #d33b2c;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.search-container {
    width: 100%;
    max-width: 584px;
    margin-bottom: 20px;
}

.search-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.search-box {
    position: relative;
    width: 100%;
    background: white;
    border-radius: 24px;
    box-shadow: 0 2px 5px 1px rgba(64,60,67,.16);
    display: flex;
    align-items: center;
    padding: 0 8px 0 16px;
    transition: box-shadow 0.3s;
    height: 48px;
}

.search-box:hover {
    box-shadow: 0 2px 8px 1px rgba(64,60,67,.24);
}

.search-box:focus-within {
    box-shadow: 0 2px 8px 1px rgba(64,60,67,.24);
}

.search-icon-left {
    color: #9aa0a6;
    display: flex;
    align-items: center;
    margin-right: 12px;
    flex-shrink: 0;
}

#searchInput {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 0;
    font-size: 16px;
    color: #333;
    background: transparent;
    min-width: 0;
}

#searchInput::placeholder {
    color: #9aa0a6;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    flex-shrink: 0;
}

.voice-search {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #4285f4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    width: 32px;
    height: 32px;
}

.voice-search:hover {
    background-color: #f8f9fa;
}

/* Auth pages styles */
.auth-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4285f4;
}

.form-group small {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    line-height: 1.4;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-bottom: 10px;
    box-sizing: border-box;
    font-weight: 500;
}

.btn-primary {
    background-color: #4285f4;
    color: white;
}

.btn-primary:hover {
    background-color: #3367d6;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    display: none;
    font-size: 14px;
}

.success-message {
    color: #155724;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    display: none;
    font-size: 14px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.auth-links a {
    color: #4285f4;
    text-decoration: none;
    font-size: 14px;
}

.auth-links a:hover {
    text-decoration: underline;
}

#questionSection {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

#securityQuestion {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    color: #333;
    font-weight: 500;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

/* Search History Styles */
.search-history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(66, 133, 244, 0.1);
    z-index: 999;
    max-height: 400px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    margin-top: -8px;
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-history-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    background: rgba(66, 133, 244, 0.03);
    border-bottom: 1px solid rgba(66, 133, 244, 0.1);
    backdrop-filter: blur(10px);
}

.history-header h4 {
    font-size: 14px;
    color: #1a73e8;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-header h4 {
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-header h4::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a73e8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.clear-history-btn {
    background: linear-gradient(135deg, #ea4335, #d33b2c);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(234, 67, 53, 0.2);
}

.clear-history-btn:hover {
    background: linear-gradient(135deg, #d33b2c, #b52d20);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(234, 67, 53, 0.3);
}

.history-items {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px 0;
}

.history-items::-webkit-scrollbar {
    width: 6px;
}

.history-items::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.history-items::-webkit-scrollbar-thumb {
    background: rgba(66, 133, 244, 0.3);
    border-radius: 3px;
}

.history-items::-webkit-scrollbar-thumb:hover {
    background: rgba(66, 133, 244, 0.5);
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
}

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

.history-item:hover {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.08), rgba(66, 133, 244, 0.04));
    transform: translateX(4px);
    border-left: 3px solid #4285f4;
    padding-left: 17px;
}

.history-item-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4285f4, #1a73e8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-query {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.history-date {
    color: #666;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
}

.no-history {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.no-history::before {
    content: "";
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
}

.history-search {
    background: linear-gradient(135deg, #4285f4, #1a73e8);
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
}

.history-search:hover {
    background: linear-gradient(135deg, #3367d6, #1557b0);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(66, 133, 244, 0.3);
}

/* Desktop optimization */
@media (min-width: 1024px) {
    body {
        background: linear-gradient(135deg, #4285f4 0%, #ffffff 50%, #1a73e8 100%);
        font-size: 16px;
    }

    .container {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 40px;
    }

    .auth-card {
        width: 100%;
        max-width: 450px;
        padding: 50px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        margin: 0 auto;
    }

    .auth-card h2 {
        font-size: 28px;
        margin-bottom: 35px;
        color: #2c3e50;
        font-weight: 600;
    }

    .form-group {
        margin-bottom: 25px;
    }

    .form-group label {
        font-size: 15px;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 8px;
    }

    .form-group input {
        padding: 15px 18px;
        font-size: 16px;
        border: 2px solid #e1e8ed;
        border-radius: 8px;
        transition: all 0.3s ease;
    }

    .form-group input:focus {
        border-color: #4285f4;
        box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
    }

    .btn-primary, .btn-secondary {
        padding: 15px 18px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.3s ease;
        margin-bottom: 15px;
    }

    .btn-primary:hover {
        background-color: #3367d6;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(66, 133, 244, 0.3);
    }

    .btn-secondary:hover {
        background-color: #5a6268;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3);
    }

    .auth-links {
        margin-top: 25px;
        padding-top: 25px;
    }

    .auth-links a {
        font-weight: 500;
        transition: color 0.3s ease;
        font-size: 15px;
    }

    .auth-links a:hover {
        color: #3367d6;
    }

    #securityQuestion {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border: 1px solid #dee2e6;
        padding: 20px;
        border-radius: 8px;
        font-size: 16px;
    }

    .error-message, .success-message {
        border-radius: 8px;
        font-weight: 500;
        padding: 15px;
        margin-top: 15px;
        font-size: 15px;
    }

    /* Desktop index page styles */
    .container:not(.auth-container) {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .main-content {
        padding-top: 100px;
        padding-left: 40px;
        padding-right: 40px;
    }

    .search-container {
        max-width: 584px;
    }
}

/* Large desktop screens */
@media (min-width: 1440px) {
    .auth-card {
        max-width: 500px;
        padding: 60px;
    }

    .auth-card h2 {
        font-size: 32px;
        margin-bottom: 40px;
    }

    .form-group input {
        padding: 18px 20px;
        font-size: 18px;
    }

    .btn-primary, .btn-secondary {
        padding: 18px 20px;
        font-size: 18px;
    }
}

/* Tablet and mobile responsive */
@media (max-width: 1023px) {
    .container {
        padding: 20px;
    }

    .auth-card {
        max-width: 100%;
        margin: 20px auto;
        padding: 30px;
    }

    /* Index page mobile styles */
    .main-header {
        padding: 15px 0;
        margin-bottom: 40px;
    }

    .main-content {
        padding-top: 60px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .search-container {
        max-width: 100%;
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .auth-card {
        padding: 25px;
        margin: 15px auto;
        border-radius: 10px;
    }

    .main-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        margin-bottom: 30px;
        padding: 10px 0;
    }

    .logo {
        font-size: 28px;
    }

    .user-section {
        margin-left: 0;
        margin-right: 0;
    }

    .user-dropdown {
        position: relative;
    }

    .dropdown-menu {
        right: 0;
        left: auto;
    }

    .search-container {
        max-width: 100%;
        margin-bottom: 15px;
    }

    .main-content {
        padding-top: 40px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .search-box {
        height: 44px;
    }

    #searchInput {
        font-size: 16px;
    }

    /* Search History Responsive Styles */
    .search-history-dropdown {
        left: -8px;
        right: -8px;
        margin-top: 6px;
        border-radius: 0 0 12px 12px;
        max-height: 350px;
    }

    .history-header {
        padding: 12px 16px 10px;
    }

    .history-header h4 {
        font-size: 13px;
    }

    .clear-history-btn {
        font-size: 10px;
        padding: 5px 10px;
    }

    .history-item {
        padding: 10px 16px;
        gap: 10px;
    }

    .history-item:hover {
        padding-left: 13px;
        border-left: 2px solid #4285f4;
    }

    .history-item-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .history-query {
        font-size: 13px;
    }

    .history-date {
        font-size: 10px;
    }

    .history-items {
        max-height: 280px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .auth-card {
        padding: 20px;
        margin: 10px auto;
    }

    .auth-card h2 {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 16px;
    }

    .btn-primary, .btn-secondary {
        padding: 12px 14px;
        font-size: 16px;
    }

    .logo {
        font-size: 24px;
    }

    .main-content {
        padding-top: 30px;
        padding-left: 5px;
        padding-right: 5px;
    }

    .search-container {
        margin-bottom: 10px;
    }

    .search-box {
        height: 42px;
        padding: 0 6px 0 14px;
    }

    .voice-search {
        width: 28px;
        height: 28px;
    }

    /* Search History Responsive Styles */
    .search-history-dropdown {
        left: -4px;
        right: -4px;
        max-height: 300px;
        border-radius: 0 0 10px 10px;
    }

    .history-header {
        padding: 10px 12px 8px;
    }

    .history-header h4 {
        font-size: 12px;
    }

    .clear-history-btn {
        font-size: 9px;
        padding: 4px 8px;
    }

    .history-items {
        max-height: 220px;
        padding: 4px 0;
    }

    .history-item {
        padding: 8px 12px;
        gap: 8px;
    }

    .history-item:hover {
        padding-left: 10px;
        border-left: 2px solid #4285f4;
        transform: translateX(2px);
    }

    .history-item-icon {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .history-content {
        gap: 2px;
    }

    .history-query {
        font-size: 12px;
    }

    .history-date {
        font-size: 9px;
    }

    .search-actions {
        gap: 4px;
    }

    .history-search,
    .voice-search {
        width: 28px;
        height: 28px;
    }

    .no-history {
        padding: 30px 15px;
        font-size: 12px;
    }

    .no-history::before {
        font-size: 24px;
    }
}

/* Auth container specific styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

@media (max-width: 768px) {
    .auth-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 10px;
    }
}



#searchValidationMessage {
    color: #ff4444;
    font-size: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: rgba(255, 68, 68, 0.1);
    border-radius: 6px;
    border-left: 3px solid #ff4444;
    text-align: left;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.search-box.invalid {
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.3) !important;
}