@import url("https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700;800&display=swap");

/* ============================================
   MODERN THEME VARIABLES
   ============================================ */
:root {
    /* Primary Background with Gradient */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-overlay: rgba(255, 255, 255, 0.95);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    
    /* Text Colors */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    /* Accent Colors - Vibrant Gradients */
    --accent-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --accent-warning: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Solid Colors for borders/text */
    --color-primary: #667eea;
    --color-secondary: #f5576c;
    --color-success: #00f2fe;
    --color-warning: #fee140;
    
    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(102, 126, 234, 0.1);
    --shadow-md: 0 4px 16px rgba(102, 126, 234, 0.15);
    --shadow-lg: 0 8px 32px rgba(102, 126, 234, 0.2);
    --shadow-xl: 0 16px 48px rgba(102, 126, 234, 0.25);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    
    /* Error */
    --error-bg: #fff5f5;
    --error-border: #fc8181;
    --error-text: #c53030;
}

body.dark-theme {
    /* Dark Background with Gradient */
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-overlay: rgba(26, 26, 46, 0.95);
    --bg-card: rgba(30, 30, 50, 0.8);
    --bg-card-hover: rgba(40, 40, 60, 0.9);
    
    /* Text Colors */
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    
    /* Keep vibrant accents */
    --accent-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --accent-warning: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Borders & Shadows */
    --border-color: #2d3748;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    
    /* Glass Effect for Dark */
    --glass-bg: rgba(30, 30, 50, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    
    /* Error */
    --error-bg: rgba(127, 29, 29, 0.3);
    --error-border: #fc8181;
    --error-text: #feb2b2;
}

/* ============================================
   BASE STYLES & RESET
   ============================================ */
*,
*::before,
*::after {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", "Hind Siliguri", sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: -2;
    transition: all 0.3s ease;
}

.animated-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

.animated-bg::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.1) 0%, transparent 70%);
    animation: rotate 15s linear infinite reverse;
}

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

main {
    flex: 1;
    position: relative;
    z-index: 1;
}

::selection {
    background: var(--color-primary);
    color: white;
}

/* ============================================
   MODERN HEADER
   ============================================ */
.modern-header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-wrapper {
    width: 50px;
    height: 50px;
    background: var(--accent-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    animation: float 3s ease-in-out infinite;
}

.icon-wrapper svg {
    color: white;
    stroke: white;
}

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

.title-wrapper {
    display: flex;
    flex-direction: column;
}

.main-title {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--accent-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 1.2;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.5px;
}

/* Modern Theme Toggle */
.modern-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.toggle-track {
    width: 64px;
    height: 32px;
    background: var(--border-color);
    border-radius: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.toggle-track:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.toggle-thumb {
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    left: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-theme .toggle-thumb {
    transform: translateX(32px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-track .sun-icon,
.toggle-track .moon-icon {
    position: relative;
    z-index: 1;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.toggle-track .sun-icon {
    opacity: 1;
}

.toggle-track .moon-icon {
    opacity: 0.3;
}

body.dark-theme .toggle-track .sun-icon {
    opacity: 0.3;
}

body.dark-theme .toggle-track .moon-icon {
    opacity: 1;
    color: white;
}

/* ============================================
   MAIN CONTAINER & GLASS CARDS
   ============================================ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

/* ============================================
   INPUT CARD & FORM STYLES
   ============================================ */
.input-card form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

.input-label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label-text {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.label-icon {
    font-size: 1.25rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    flex: 1;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: "Hind Siliguri", "Inter", sans-serif;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.copy-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: var(--border-color);
    color: var(--color-primary);
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent-primary);
}

.btn-secondary {
    background: var(--accent-secondary);
}

.btn-accent {
    background: var(--accent-warning);
}

.btn-success {
    background: var(--accent-success);
}

/* ============================================
   VISUALIZATION CARD
   ============================================ */
.visualization-card {
    min-height: 300px;
}

.visualization-content {
    position: relative;
    padding: 2rem 0;
    text-align: center;
    max-height: 600px;
    overflow: auto;
}

#app .sentence {
    text-align: center;
    white-space: nowrap;
    display: inline-block;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0;
}

#app .sentence .word {
    display: inline-block;
    margin: 0 0.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
    position: relative;
    background: var(--bg-card);
}

#app .sentence .word:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

#app .sentence .word.highlight:not(.alignable) {
    color: var(--color-primary);
    background: rgba(102, 126, 234, 0.1);
}

#app .sentence .word.alignable {
    border-color: var(--color-success);
    border-style: dashed;
}

#app .sentence .word.alignable::before {
    content: "+";
    position: absolute;
    top: -8px;
    left: -8px;
    background: var(--color-success);
    font-size: 12px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    color: white;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
}

#app .sentence .word.removable {
    border-color: var(--color-secondary);
    border-style: dashed;
}

#app .sentence .word.removable::before {
    content: "−";
    background: var(--color-secondary);
}

#alignments {
    height: 120px;
    width: 100%;
    margin: 1rem auto;
}

#alignments svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

#alignments svg line {
    stroke: var(--text-secondary);
    stroke-width: 2px;
    transition: all 0.3s ease;
}

#alignments svg line.highlight {
    stroke: var(--color-primary);
    stroke-width: 3px;
}

/* ============================================
   GUIDELINES CARD
   ============================================ */
.guidelines-card h3 {
    margin-bottom: 1rem;
}

.guidelines-list {
    list-style: none;
    counter-reset: guideline-counter;
    padding: 0;
}

.guidelines-list li {
    counter-increment: guideline-counter;
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.guidelines-list li::before {
    content: counter(guideline-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--accent-primary);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.guidelines-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================
   ERROR CARD
   ============================================ */
.error-card {
    display: none;
    background: var(--error-bg);
    border: 2px solid var(--error-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: var(--error-text);
    box-shadow: var(--shadow-md);
}

.error-card p {
    margin: 0;
    font-weight: 500;
}

/* ============================================
   FOOTER
   ============================================ */
.modern-footer {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.modern-footer p {
    margin: 0;
    font-size: 0.9375rem;
}

.modern-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.modern-footer a:hover {
    color: var(--color-secondary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .main-container {
        padding: 1.5rem;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 1rem 1.5rem;
    }
    
    .icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .main-title {
        font-size: 1.25rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
    
    .main-container {
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .glass-card {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    #app .sentence {
        font-size: 1rem;
    }
    
    #app .sentence .word {
        margin: 0 0.25rem;
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    #alignments {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}
