/* ============================================
   CSS RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #ffa751 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ============================================
   CONTAINER & CARD
   ============================================ */
.container {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, #f5576c 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

/* ============================================
   FORM STYLES
   ============================================ */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-left: 4px;
}

.form-group input,
.form-group select {
    padding: 14px 18px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    color: #333;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(118, 75, 162, 0.1);
    transform: translateY(-2px);
}

.form-group input::placeholder {
    color: #999;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

/* ============================================
   BUTTON STYLES
   ============================================ */
.submit-btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.5);
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Loader animation */
.btn-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESULTS SECTION
   ============================================ */
.results {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
    border: 2px solid rgba(118, 75, 162, 0.2);
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #764ba2;
    margin-bottom: 15px;
}

.results-content {
    color: #333;
    line-height: 1.8;
    font-size: 0.95rem;
}

.results-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.results-content h3:first-child {
    margin-top: 0;
}

.results-content p {
    margin-bottom: 12px;
}

.results-content ul,
.results-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.results-content li {
    margin-bottom: 8px;
}

.results-content strong {
    color: #764ba2;
}

/* ============================================
   ERROR STYLES
   ============================================ */
.error {
    margin-top: 20px;
    padding: 16px;
    background: rgba(245, 87, 108, 0.1);
    border: 2px solid rgba(245, 87, 108, 0.3);
    border-radius: 12px;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.error p {
    color: #d32f2f;
    font-weight: 500;
    margin: 0;
}

/* ============================================
   API KEY INFO
   ============================================ */
.api-key-info {
    margin-top: 20px;
    text-align: center;
    color: white;
    font-size: 0.9rem;
}

.api-key-info p {
    margin-bottom: 8px;
}

.link-btn {
    background: none;
    border: none;
    color: white;
    text-decoration: underline;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    transition: opacity 0.3s ease;
}

.link-btn:hover {
    opacity: 0.8;
}

/* ============================================
   MODAL STYLES
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: #764ba2;
    margin-bottom: 15px;
    font-size: 1.6rem;
}

.modal-content p {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-info {
    background: rgba(102, 126, 234, 0.1);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.modal-info ol {
    margin-left: 20px;
    margin-top: 10px;
}

.modal-info li {
    margin-bottom: 8px;
    color: #333;
}

.modal-info a {
    color: #667eea;
    font-weight: 600;
}

.note {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 12px;
}

.api-key-input {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.api-key-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(118, 75, 162, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 640px) {
    .card {
        padding: 30px 25px;
    }

    .title {
        font-size: 1.6rem;
    }

    .modal-content {
        padding: 30px 25px;
    }

    .submit-btn {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .card {
        padding: 25px 20px;
    }

    .title {
        font-size: 1.4rem;
    }

    .form-group input,
    .form-group select {
        padding: 12px 16px;
    }
}