* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f172a 100%);
    background-attachment: fixed;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-name {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 50%, #9ca3af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    text-align: center;
    animation: fadeInScale 0.8s ease-out;
    position: relative;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.app-name::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    border-radius: 2px;
    animation: expandLine 1s ease-out 0.5s both;
}

@keyframes expandLine {
    from {
        width: 0;
    }
    to {
        width: 60px;
    }
}

.input-section {
    width: 100%;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    padding: 14px 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.input-container:focus-within {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.15),
        0 8px 32px rgba(59, 130, 246, 0.2);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.input-icons-left {
    display: flex;
    gap: 8px;
    margin-right: 12px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.icon-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.icon-btn:hover::before {
    width: 100%;
    height: 100%;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.icon-btn:active {
    transform: translateY(0);
}

.icon-btn svg {
    position: relative;
    z-index: 1;
}

.icon-btn:first-child {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
}

.input-field {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
}

.input-field::placeholder {
    color: #6b7280;
}

.input-icons-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 12px;
}

.model-select {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #ffffff;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
    font-weight: 500;
}

.model-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.model-select:focus {
    border-color: rgba(59, 130, 246, 0.5);
}

.model-select option {
    background: #1a1a1a;
    color: #ffffff;
    padding: 8px;
    border: none;
}

.model-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.model-select:focus {
    border-color: rgba(59, 130, 246, 0.5);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.send-btn:hover:not(:disabled)::before {
    width: 120%;
    height: 120%;
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(99, 102, 241, 0.4));
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0) scale(1);
}

.send-btn svg {
    position: relative;
    z-index: 1;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.response-section {
    width: 100%;
    margin-top: 20px;
    position: relative;
}

.response-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.copy-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.copy-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.copy-btn:active {
    transform: translateY(0) scale(0.95);
}

.copy-btn.copied {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(16, 185, 129, 0.3));
    border-color: rgba(34, 197, 94, 0.6);
    color: #22c55e;
    animation: copiedPulse 0.6s ease-out;
}

@keyframes copiedPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.response-content {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 28px;
    color: #e5e7eb;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.response-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.response-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.response-content pre code {
    background: none;
    padding: 0;
}

/* Scrollbar styling */
.input-field::-webkit-scrollbar,
.response-content::-webkit-scrollbar {
    width: 6px;
}

.input-field::-webkit-scrollbar-track,
.response-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.input-field::-webkit-scrollbar-thumb,
.response-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.input-field::-webkit-scrollbar-thumb:hover,
.response-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* PIN Entry Styles */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f172a 100%);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.4s ease-out;
}

.pin-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 20px;
    animation: fadeInScale 0.6s ease-out;
}

.pin-input-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.pin-input-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.pin-display {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 20px 0;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.pin-dot.filled {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-color: #3b82f6;
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.2),
        0 4px 12px rgba(59, 130, 246, 0.3);
    transform: scale(1.1);
    animation: pulse 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1.2);
    }
}

.pin-error {
    color: #ef4444;
    font-size: 14px;
    text-align: center;
    margin-top: -10px;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.pin-key {
    aspect-ratio: 1;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.pin-key::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.pin-key:hover::before {
    width: 150%;
    height: 150%;
}

.pin-key:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(59, 130, 246, 0.6);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.pin-key:active {
    transform: scale(0.95);
}

.pin-key span {
    position: relative;
    z-index: 1;
}

.pin-key-clear {
    font-size: 20px;
    color: #ef4444;
}

.pin-key-submit {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(99, 102, 241, 0.25));
    border-color: rgba(59, 130, 246, 0.6);
    color: #3b82f6;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.pin-key-submit:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(99, 102, 241, 0.4));
    border-color: #3b82f6;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: scale(1.1) translateY(-2px);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.setting-item label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.setting-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.setting-select:focus {
    border-color: rgba(59, 130, 246, 0.5);
}

.setting-select option {
    background: #1a1a1a;
    color: #ffffff;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.5);
    backdrop-filter: blur(10px);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-primary:hover::before {
    width: 300%;
    height: 300%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(99, 102, 241, 0.35));
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    color: #9ca3af;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Web Search Active State */
.icon-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(99, 102, 241, 0.25));
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    }
}

/* Image Preview */
.image-preview-modal .modal-content {
    max-width: 600px;
}

#imagePreviewContainer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

#imagePreviewContainer img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-preview-item {
    position: relative;
    display: inline-block;
}

.image-preview-item .remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.8);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.image-preview-item .remove-image:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        gap: 30px;
        padding: 10px;
    }
    
    .app-name {
        font-size: 36px;
    }
    
    .input-container {
        padding: 12px 14px;
        border-radius: 16px;
    }
    
    .icon-btn {
        width: 34px;
        height: 34px;
    }
    
    .model-select {
        min-width: 150px;
        font-size: 13px;
    }
    
    .response-content {
        padding: 20px;
    }
    
    .modal-content {
        width: 95%;
        border-radius: 20px;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
