@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;700;900&display=swap');

/* ===== ROOT VARIABLES ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Bengali', sans-serif;
    color: #1f2937;
    overflow-x: hidden;
}

.modern-gradient {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.bg-pattern {
    background-image: 
        radial-gradient(circle at 25px 25px, rgba(102, 126, 234, 0.2) 2%, transparent 0%),
        radial-gradient(circle at 75px 75px, rgba(118, 75, 162, 0.2) 2%, transparent 0%);
    background-size: 100px 100px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ===== HEADER STYLES ===== */
.header-gradient {
    background: var(--primary-gradient);
    position: relative;
    overflow: hidden;
}

.header-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 15s ease-in-out infinite;
}

.header-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s ease-in-out infinite;
    display: inline-block;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-30px, 30px) rotate(240deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.animate-fade-in {
    animation: fadeIn 0.8s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out 0.2s both;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 10px #4ade80;
}

/* ===== CARD STYLES ===== */
.card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border: 2px solid #e5e7eb;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--card-shadow-hover);
    border-color: #667eea;
}

.card:hover::before {
    transform: scaleX(1);
}

/* Category Cards */
.category-card {
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 2px solid #e5e7eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.category-card:hover::before {
    transform: scaleX(1);
}

/* Template Cards */
.template-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06);
    border: 2px solid #e5e7eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.template-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.12);
    border-color: #f093fb;
}

.template-card:hover::after {
    transform: scaleY(1);
}

/* Search Bar Styles */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1.1rem;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Search Results */
.search-results {
    animation: fadeInUp 0.4s ease-out;
}

.search-no-results {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 2px solid #f3f4f6;
}

.search-no-results svg {
    margin: 0 auto 1rem auto;
    opacity: 0.5;
}

/* Enhanced Category Cards for Writing First */
.category-card.writing-category {
    border: 2px solid #f093fb;
    background: linear-gradient(135deg, #fdf2f8 0%, #fff 100%);
}

.category-card.writing-category::before {
    background: var(--secondary-gradient);
}

.category-card.writing-category:hover {
    border-color: #f093fb;
    box-shadow: 0 20px 50px rgba(240, 147, 251, 0.2);
}

/* Category Icons */
.category-icon {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: linear-gradient(135deg, #667eea22 0%, #764ba244 100%);
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.category-icon::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    top: -50%;
    left: -50%;
    animation: float 10s ease-in-out infinite;
}

.category-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea22 0%, #764ba244 100%);
}

/* ===== PROMPT CARD STYLES ===== */
.prompt-card {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.prompt-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.prompt-card:hover {
    background: white;
    border-color: #667eea;
    transform: translateX(8px);
}

.prompt-card:hover::before {
    transform: scaleY(1);
}

/* ===== FORM STYLES ===== */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.input-group input, 
.input-group select, 
.input-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    font-family: 'Noto Sans Bengali', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.input-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
    padding: 1rem 1.25rem;
}

.input-group input:focus, 
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* Enhanced textarea styling */
.input-group textarea {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    font-size: 1.05rem;
    line-height: 1.7;
    padding: 1.25rem;
    resize: vertical;
    min-height: 150px;
}

.input-group textarea:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.input-group textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Character counter styling */
.input-group .text-xs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/* Security warning styles */
.security-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #f87171;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== BUTTON STYLES ===== */
.button-primary {
    background: var(--primary-gradient);
    color: white;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.button-primary::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;
}

.button-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.button-primary:hover::before {
    left: 100%;
}

.button-primary:active {
    transform: translateY(-1px);
}

.button-secondary {
    background: white;
    color: #667eea;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-weight: 600;
    border: 2px solid #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.button-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* ===== RESPONSE CONTAINER ===== */
#response-container {
    background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
    padding: 2.5rem;
    border-radius: 1.5rem;
    white-space: pre-wrap;
    line-height: 1.8;
    border: 2px solid #bfdbfe;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    font-size: 1.1rem;
    font-family: 'Noto Sans Bengali', sans-serif;
    max-width: 100%;
    overflow-x: auto;
}

/* Enhanced response formatting */
#response-container h1,
#response-container h2,
#response-container h3 {
    font-weight: bold;
    margin: 2rem 0 1.5rem 0;
    color: #1f2937;
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    background: rgba(102, 126, 234, 0.05);
    padding: 1rem;
    border-radius: 0.5rem;
}

#response-container h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: none;
}

#response-container h2 {
    font-size: 1.5rem;
    color: #667eea;
}

#response-container h3 {
    font-size: 1.3rem;
    color: #374151;
}

/* Better paragraph spacing */
#response-container p {
    margin: 1.5rem 0;
    line-height: 1.8;
    text-align: justify;
}

/* Better list formatting */
#response-container ul,
#response-container ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0.75rem;
    padding: 1.5rem 2rem;
    border-left: 4px solid #f093fb;
}

#response-container li {
    margin: 1rem 0;
    line-height: 1.7;
    font-size: 1.05rem;
}

/* Code and emphasis */
#response-container strong {
    font-weight: bold;
    color: #1f2937;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
}

#response-container em {
    font-style: italic;
    color: #4b5563;
    background: rgba(240, 147, 251, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
}

/* Block quotes - for examples */
#response-container blockquote {
    border-left: 4px solid #10b981;
    padding: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 0.75rem;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

#response-container blockquote::before {
    content: '"';
    font-size: 4rem;
    color: #10b981;
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    font-family: serif;
    opacity: 0.3;
}

/* Tables */
#response-container table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    overflow: hidden;
    background: white;
}

#response-container th,
#response-container td {
    border: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 1rem;
}

#response-container th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

#response-container tr:nth-child(even) {
    background-color: #f9fafb;
}

#response-container tr:hover {
    background-color: #f3f4f6;
}

/* Code blocks */
#response-container pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    margin: 2rem 0;
    border-left: 4px solid #10b981;
}

#response-container code {
    background: rgba(31, 41, 55, 0.1);
    padding: 0.3rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: #dc2626;
}

/* Horizontal rules */
#response-container hr {
    border: none;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 3rem 0;
    border-radius: 1px;
}

/* Links */
#response-container a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

#response-container a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

/* Special formatting for emojis and icons */
#response-container p:has(::first-child) {
    margin-top: 2rem;
}

/* Special note styling */
#response-container .note {
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    display: block;
    font-style: italic;
    color: #856404;
}

/* Section dividers */
#response-container hr {
    margin: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 3px;
    border-radius: 2px;
}

/* Better spacing for Bengali text */
#response-container {
    word-spacing: 0.1rem;
    letter-spacing: 0.02rem;
}

/* Responsive design */
@media (max-width: 768px) {
    #response-container {
        padding: 1.5rem;
        font-size: 1rem;
    }
    
    #response-container h1 {
        font-size: 1.5rem;
    }
    
    #response-container h2 {
        font-size: 1.3rem;
    }
    
    #response-container h3 {
        font-size: 1.2rem;
    }
    
    #response-container table {
        font-size: 0.9rem;
    }
    
    #response-container th,
    #response-container td {
        padding: 0.75rem;
    }
}

#response-area {
    animation: fadeInUp 0.5s ease-out;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    border: 5px solid rgba(102, 126, 234, 0.1);
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

.loading-spinner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    margin-top: 2rem;
    padding: 3rem 2rem;
    background: white;
    border-radius: 1.5rem;
    box-shadow: var(--card-shadow);
}

.loading-spinner-container .mt-4 {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 600;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.text-sm {
    font-size: 0.875rem;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.gap-4 {
    gap: 1rem;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-icon {
        font-size: 3rem;
    }
    
    h1 {
        font-size: 2rem !important;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .button-primary,
    .button-secondary {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}