@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css');

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Georgia', serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    color: #3a2e2e;
    background: #fff;
    perspective: 1000px;
    position: relative;
    overflow-x: hidden;
}

.background {
    position: absolute;
    top: -50%;
    left: -30%;
    width: 140%;
    height: 150%;
    background-image: url('kolam.webp');
    background-size: 300px 300px;
    background-repeat: repeat;
    transform: rotateX(60deg) translateY(30%);
    opacity: 0.25;
    z-index: 0;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    color: #3a2e2e;
    text-align: center;
    margin: 20px 0;
    background: linear-gradient(90deg, #FFD700, #FF4500, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 60s infinite linear;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

h1 a {
    text-decoration: none;
    color: inherit;
}

@keyframes shine {
    0% { background-position: -1000px; }
    40% { background-position: 1000px; }
    60% { background-position: 1000px; }
    100% { background-position: -1000px; }
}

.container {
    text-align: center;
    padding: 15px;
    border: 1px solid #d1c2c2;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.80);
    box-shadow: 0 0 10px rgba(20, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    margin: 3px 0;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
}

.description {
    margin: 10px 0;
    font-size: 1rem;
    color: #6e5c5c;
}

select, textarea, button {
    width: calc(100% - 30px);
    padding: 10px;
    margin: 10px 15px;
    border: 1px solid #d1c2c2;
    border-radius: 4px;
    font-size: 1rem;
    color: #3a2e2e;
    background-color: #faf6f6;
    box-sizing: border-box;
    font-family: 'Georgia', serif;
}

select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path fill="%23867070" d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 16px 16px;
}

textarea {
    resize: vertical;
    min-height: 150px;
}

select:focus, textarea:focus {
    border-color: #b38080;
    outline: none;
}

button {
    border: none;
    border-radius: 4px;
    background-color: #5e4949;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

button i {
    margin-left: 8px;
}

button:hover {
    background-color: #3a2e2e;
}

.light-button {
    background-color: #7e6b6b;
}

.light-button:hover {
    background-color: #5e4949;
}

#waitingOverlay {
    display: none;
    position: fixed;
    z-index: 3;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 248, 248, 0.8);
    justify-content: center;
    align-items: center;
}

.spinner {
    border: 8px solid #f3e9e9;
    border-top: 8px solid #5e4949;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 2;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(20, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #d1c2c2;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    padding-top: 10px;
    border-top: 1px solid #f3e9e9;
}

.button-group {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.button-group button {
    margin: 0;
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #b3a3a3;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #3a2e2e;
}

.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #5e4949;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 4;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
    from { bottom: 30px; opacity: 1; }
    to { bottom: 0; opacity: 0; }
}

.footer {
    text-align: center;
    font-size: 0.8rem;
    color: #a19191;
    position: absolute;
    bottom: 10px;
    width: 100%;
    padding: 10px;
}

.footer a {
    color: #a19191;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #5e4949;
    text-decoration: underline;
}

.question-item {
    background-color: rgba(255, 252, 252, 0.9);
    border: 1px solid #e0d4d4;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    transition: transform 0.2s ease;
}

.question-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.question-link {
    font-size: 1.1rem;
    color: #3a2e2e;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
}

.question-meta {
    font-size: 0.8rem;
    color: #b3a3a3;
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.tag {
    font-size: 0.75rem;
    color: #5e4949;
    background-color: #f3e9e9;
    border: 1px solid #e0d4d4;
    border-radius: 12px;
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.tag:hover {
    background-color: #e0d4d4;
}

.floating-share {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background-color: rgba(211, 195, 195, 0.7);
    color: #3a2e2e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(20, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-share:hover {
    background-color: rgba(211, 195, 195, 0.9);
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(20, 0, 0, 0.3);
}

.answer {
    text-align: left;
    line-height: 1.6;
    color: #3a2e2e;
}

.answer p {
    margin: 1em 0;
}

.answer h1, .answer h2, .answer h3 {
    color: #5e4949;
    margin: 1.5em 0 1em;
}

.related-questions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f3e9e9;
}

.related-questions ul {
    list-style-type: none;
    padding: 0;
    margin: 10px 0;
}

.related-questions li {
    margin: 8px 0;
}

.related-questions a {
    color: #6e5c5c;
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-questions a:hover {
    color: #3a2e2e;
    text-decoration: underline;
}

.disclaimer {
    font-size: 0.8rem;
    color: #867070;
    font-style: italic;
    margin: 10px 0;
    padding: 10px;
    background-color: #faf6f6;
    border-radius: 4px;
}

.error-message {
    color: #cc0000;
    background-color: #fff2f2;
    border: 1px solid #ffcccc;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        width: 95%;
        padding: 10px;
        margin: 10px auto;
        max-height: calc(100vh - 180px);
    }

    h1 {
        font-size: 2rem;
        margin: 15px 0;
    }

    textarea {
        min-height: 120px;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
        max-height: 85vh;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
        margin: 5px 0;
    }

    .floating-share {
        bottom: 70px;
        right: 15px;
        width: 35px;
        height: 35px;
    }

    .footer {
        bottom: 5px;
        font-size: 0.7rem;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .container {
        width: 85%;
        max-width: 800px;
    }

    textarea {
        min-height: 180px;
    }

    .modal-content {
        width: 80%;
        max-width: 700px;
    }
}

@media (min-width: 1025px) {
    .container {
        width: 70%;
        max-width: 1000px;
    }

    textarea {
        min-height: 200px;
    }

    .question-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
}

/* Print styles */
@media print {
    .floating-share,
    .footer,
    button,
    .toast {
        display: none !important;
    }

    .container {
        box-shadow: none;
        border: none;
    }

    .answer {
        font-size: 12pt;
        line-height: 1.5;
    }
}