/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: #2c3e50;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.03"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    pointer-events: none;
    z-index: 1;
}

/* Header Styles */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

header h1 {
    margin: 0;
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

header p {
    margin: 0.5rem 0 0;
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 400;
}

/* Main Content Styles */
main {
    flex-grow: 1;
    position: relative;
    z-index: 5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
    align-items: stretch;
    min-height: 500px;
}

/* 27-inch Monitor Optimization (2560x1440) */
@media (min-width: 1440px) and (max-width: 1599px) {
    .container {
        max-width: 1400px;
        padding: 3.5rem 2rem;
    }
    
    .main-layout {
        gap: 3rem;
        min-height: 550px;
        grid-template-columns: 1.2fr 0.8fr;
    }
    
    header {
        padding: 2.5rem;
    }
    
    header h1 {
        font-size: 3.2rem;
    }
    
    .textarea-container {
        padding: 2.5rem;
    }
    
    .stats-container {
        padding: 2.5rem;
    }
    
    #text-input {
        min-height: 380px;
        font-size: 1.15rem;
        padding: 1.8rem;
    }
    
    .primary-stats .stat-value {
        font-size: 3.5rem;
    }
    
    .toolbar button,
    .toolbar .upload-label {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .content-section .content-wrapper {
        max-width: 1400px;
    }
}

/* Ultra-wide screen support */
@media (min-width: 1600px) {
    .container {
        max-width: 1600px;
        padding: 4rem 2rem;
    }
    
    .main-layout {
        gap: 4rem;
        min-height: 600px;
    }
    
    header h1 {
        font-size: 4rem;
    }
    
    .textarea-container,
    .stats-container {
        padding: 3rem 2rem;
    }
    
    #text-input {
        min-height: 450px;
        font-size: 1.3rem;
        padding: 2rem;
    }
    
    .primary-stats .stat-value {
        font-size: 4.2rem;
    }
    
    .content-section .content-wrapper {
        max-width: 1600px;
    }
}

/* Textarea Styles */
.textarea-container {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    height: 100%;
    box-sizing: border-box;
}

.textarea-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

#text-input {
    width: 100%;
    flex: 1;
    padding: 1.5rem;
    border: 2px solid transparent;
    border-radius: 16px;
    font-size: 1.1rem;
    resize: none;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    min-height: 300px;
}

#text-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: scale(1.01);
}

#text-input::placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* Toolbar Styles */
.toolbar {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
}

.toolbar button,
.toolbar .upload-label {
    padding: 0.6rem 1rem;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
    flex: 1;
    white-space: nowrap;
}

.toolbar button::before,
.toolbar .upload-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.toolbar button:hover,
.toolbar .upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.toolbar button:hover::before,
.toolbar .upload-label:hover::before {
    left: 100%;
}

.toolbar button:active,
.toolbar .upload-label:active {
    transform: translateY(0);
}

/* Stats Container Styles */
.stats-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    height: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.stats-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.stats-container h2 {
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.primary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: center;
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    transition: all 0.3s ease;
    min-height: 100px;
}

.stat-item:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
}

.primary-stats .stat-value {
    font-size: 3.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.primary-stats .stat-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.secondary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(241, 245, 249, 0.6);
    border-bottom: 1px solid rgba(241, 245, 249, 0.6);
    margin-bottom: 2rem;
}

.secondary-stats .stat-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem;
}

.secondary-stats .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.advanced-stats h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}

.advanced-stats .stat-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(241, 245, 249, 0.6);
    border-radius: 12px;
    margin-bottom: 0.8rem;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    min-height: 50px;
}

.advanced-stats .stat-item:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.advanced-stats .stat-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.advanced-stats .stat-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

.advanced-stats .stat-value {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.content-section {
    padding: 3rem 0;
}

.content-section .content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    z-index: 5;
    max-width: 1200px;
    padding: 3rem 2rem;
}

.content-section .content-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.content-section h2 {
    color: #1e293b;
    margin-top: 0;
    border-bottom: 3px solid #667eea;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-section p,
.content-section li {
    line-height: 1.8;
    color: #475569;
    font-size: 1.1rem;
}

.content-section ul, .content-section ol {
    padding-left: 2rem;
}

.content-section li {
    margin-bottom: 0.75rem;
    position: relative;
}

.content-section li strong {
    color: #1e293b;
    font-weight: 700;
}

/* Footer Styles */
footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 2rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: #64748b;
    position: relative;
    z-index: 10;
}

/* Large Screen Optimizations */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .main-layout {
        gap: 3rem;
    }
    
    header h1 {
        font-size: 3.5rem;
    }
    
    .textarea-container,
    .stats-container {
        padding: 2.5rem;
    }
    
    #text-input {
        min-height: 400px;
        font-size: 1.2rem;
    }
    
    .primary-stats .stat-value {
        font-size: 3.8rem;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1200px;
    }
    
    .main-layout {
        gap: 2.5rem;
    }
    
    #text-input {
        min-height: 350px;
    }
}

/* Tablet and Medium Screens */
@media (max-width: 1199px) and (min-width: 993px) {
    .container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .main-layout {
        gap: 2rem;
        grid-template-columns: 1fr 1fr;
    }
    
    header h1 {
        font-size: 2.8rem;
    }
    
    .textarea-container,
    .stats-container {
        padding: 2rem;
    }
}

/* Small Tablets and Large Mobile */
@media (max-width: 992px) and (min-width: 769px) {
    .container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .stats-container {
        order: -1;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .textarea-container,
    .stats-container {
        padding: 1.8rem;
    }
    
    #text-input {
        min-height: 280px;
    }
}

/* Mobile and Small Tablets */
@media (max-width: 768px) {
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        background-attachment: scroll;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    main {
        padding: 2rem 1rem;
    }
    
    .container {
        padding: 0;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        align-items: stretch;
    }
    
    .textarea-container {
        padding: 1.5rem;
    }
    
    #text-input {
        min-height: 250px;
        font-size: 1rem;
        flex: 1;
    }
    
    .toolbar {
        gap: 0.5rem;
        margin-top: 1.5rem;
    }
    
    .toolbar button, .upload-label {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .stats-container {
        padding: 1.5rem;
        height: auto;
        display: flex;
        flex-direction: column;
    }
    
    .primary-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .primary-stats .stat-value {
        font-size: 2.2rem;
    }
    
    .secondary-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .content-section {
        padding: 2rem 1.5rem;
        margin: 2rem auto;
    }
    
    .content-section h2 {
        font-size: 1.6rem;
    }
}

/* Medium Mobile Devices */
@media (max-width: 600px) and (min-width: 481px) {
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 1.8rem 1rem;
    }
    
    .textarea-container,
    .stats-container {
        padding: 1.3rem;
    }
    
    #text-input {
        min-height: 220px;
        font-size: 1rem;
    }
    
    .toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    
    .toolbar button,
    .toolbar .upload-label {
        flex: 1;
        min-width: calc(50% - 0.3rem);
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .textarea-container {
        padding: 1rem;
    }
    
    #text-input {
        min-height: 200px;
        padding: 1rem;
        flex: 1;
    }
    
    .stats-container {
        padding: 1rem;
    }
    
    .content-section {
        padding: 1.5rem 1rem;
        margin: 2rem auto;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
        margin-top: 1rem;
    }
    
    .toolbar button, 
    .toolbar .upload-label {
        flex: none;
        width: 100%;
        max-width: none;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Loading Animation */
.loading {
    animation: shimmer 2s infinite;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
}

/* Scroll Animations */
.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

/* Enhanced Focus States */
.toolbar button:focus, .upload-label:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

#text-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: scale(1.01);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Selection Styles */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1e293b;
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: #1e293b;
}

.content-section ul, .content-section ol {
    padding-left: 20px;
}

.content-section strong {
    color: #0056b3;
}

/* Very Small Mobile Devices */
@media (max-width: 360px) {
    header {
        padding: 1rem 0.5rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 1.5rem 0.5rem;
    }
    
    .textarea-container,
    .stats-container {
        padding: 0.8rem;
        margin: 0;
    }
    
    #text-input {
        min-height: 180px;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .toolbar button,
    .toolbar .upload-label {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .primary-stats .stat-value {
        font-size: 1.8rem;
    }
    
    .content-section {
        padding: 1rem 0.5rem;
        margin: 1.5rem 0.5rem;
    }
}