/**
 * Content Simplifier Styles
 * Responsive, accessible design with modern aesthetics
 * All classes prefixed with 'csimp-' to avoid conflicts
 */

/* ===== RESET & BASE STYLES ===== */
.csimp-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.csimp-container *,
.csimp-container *::before,
.csimp-container *::after {
    box-sizing: border-box;
}

/* ===== HEADER SECTION ===== */
.csimp-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.csimp-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.csimp-description {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.95;
    font-weight: 300;
}

/* ===== MAIN TOOL WRAPPER ===== */
.csimp-tool-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* ===== CARD STYLES ===== */
.csimp-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(230, 230, 230, 0.8);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.csimp-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.csimp-card:hover::before {
    opacity: 1;
}

.csimp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.csimp-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #2d3748;
    display: flex;
    align-items: center;
}

.csimp-input-card .csimp-card-title::before {
    content: '📝';
    margin-right: 10px;
    font-size: 1.2em;
}

.csimp-output-card .csimp-card-title::before {
    content: '✨';
    margin-right: 10px;
    font-size: 1.2em;
}

/* ===== FORM ELEMENTS ===== */
.csimp-form-group {
    margin-bottom: 20px;
}

.csimp-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a5568;
    font-size: 0.95rem;
}

.csimp-textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
    background: #fafafa;
}

.csimp-textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: scale(1.01);
}

.csimp-textarea::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.csimp-output-textarea {
    background: #f7fafc;
    border-color: #cbd5e0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.csimp-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.csimp-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.csimp-select:hover {
    border-color: #cbd5e0;
}

/* ===== SETTINGS ROW ===== */
.csimp-settings-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* ===== BUTTON STYLES ===== */
.csimp-button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.csimp-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.csimp-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.csimp-btn:hover::before {
    width: 300px;
    height: 300px;
}

.csimp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.csimp-btn:disabled:hover::before {
    width: 0;
    height: 0;
}

/* Primary Button */
.csimp-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.csimp-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

/* Secondary Button */
.csimp-btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.csimp-btn-secondary:hover:not(:disabled) {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

/* Success Button */
.csimp-btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.csimp-btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

/* Outline Button */
.csimp-btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.csimp-btn-outline:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Focus styles for accessibility */
.csimp-btn:focus,
.csimp-btn-focused {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* ===== STATUS MESSAGE ===== */
.csimp-status-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 15px;
    animation: csimp-slideIn 0.3s ease-out;
}

.csimp-status-success {
    background: #f0fff4;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.csimp-status-error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.csimp-status-info {
    background: #ebf8ff;
    color: #2a4365;
    border: 1px solid #90cdf4;
}

/* ===== STATISTICS PANEL ===== */
.csimp-stats-panel {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    padding: 25px;
    margin-top: 30px;
    border: 1px solid #e2e8f0;
    animation: csimp-fadeIn 0.5s ease-out;
}

.csimp-stats-panel h4 {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    text-align: center;
}

.csimp-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.csimp-stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

.csimp-stat-label {
    display: block;
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 5px;
    font-weight: 500;
}

.csimp-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
}

/* ===== ANIMATIONS ===== */
@keyframes csimp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes csimp-slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Loading animation for buttons */
.csimp-btn-loader {
    animation: csimp-pulse 1.5s ease-in-out infinite;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet Styles */
@media screen and (max-width: 1024px) {
    .csimp-container {
        padding: 15px;
    }
    
    .csimp-tool-wrapper {
        gap: 20px;
    }
    
    .csimp-card {
        padding: 25px;
    }
    
    .csimp-title {
        font-size: 2.2rem;
    }
    
    .csimp-settings-row {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
        padding: 15px;
    }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
    .csimp-container {
        padding: 10px;
    }
    
    .csimp-tool-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .csimp-card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .csimp-header {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .csimp-title {
        font-size: 1.8rem;
    }
    
    .csimp-description {
        font-size: 1rem;
    }
    
    .csimp-settings-row {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .csimp-button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .csimp-btn {
        width: 100%;
        min-width: auto;
        justify-content: center;
    }
    
    .csimp-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .csimp-textarea {
        min-height: 100px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Small Mobile Styles */
@media screen and (max-width: 480px) {
    .csimp-container {
        padding: 8px;
    }
    
    .csimp-card {
        padding: 15px;
        border-radius: 12px;
    }
    
    .csimp-header {
        padding: 12px;
    }
    
    .csimp-title {
        font-size: 1.6rem;
    }
    
    .csimp-card-title {
        font-size: 1.3rem;
    }
    
    .csimp-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .csimp-stat-item {
        padding: 12px;
    }
    
    .csimp-settings-row {
        padding: 12px;
    }
    
    .csimp-textarea {
        padding: 12px;
        min-height: 90px;
    }
    
    .csimp-select {
        padding: 10px 12px;
    }
    
    .csimp-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    .csimp-card {
        border: 2px solid #000;
        box-shadow: none;
    }
    
    .csimp-btn-primary {
        background: #000;
        border: 2px solid #000;
    }
    
    .csimp-btn-secondary {
        background: #fff;
        border: 2px solid #000;
        color: #000;
    }
    
    .csimp-textarea:focus,
    .csimp-select:focus {
        border: 3px solid #000;
        box-shadow: none;
    }
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
    .csimp-card,
    .csimp-btn,
    .csimp-textarea,
    .csimp-select,
    .csimp-stats-panel,
    .csimp-status-message {
        transition: none;
        animation: none;
    }
    
    .csimp-btn:hover {
        transform: none;
    }
    
    .csimp-card:hover {
        transform: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .csimp-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .csimp-header {
        background: #f0f0f0 !important;
        color: #000 !important;
        text-shadow: none;
    }
    
    .csimp-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    .csimp-btn {
        display: none;
    }
    
    .csimp-textarea {
        border: 1px solid #ccc;
        background: #fff !important;
    }
    
    .csimp-stats-panel {
        background: #f9f9f9 !important;
        border: 1px solid #ccc;
    }
}

/* ===== FOCUS MANAGEMENT FOR SCREEN READERS ===== */
.csimp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .csimp-container {
        color: #e2e8f0;
    }
    
    .csimp-card {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .csimp-card-title {
        color: #f7fafc;
    }
    
    .csimp-label {
        color: #cbd5e0;
    }
    
    .csimp-textarea {
        background: #1a202c;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .csimp-textarea:focus {
        background: #2d3748;
        border-color: #667eea;
    }
    
    .csimp-select {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .csimp-settings-row {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .csimp-stats-panel {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .csimp-stats-panel h4 {
        color: #f7fafc;
    }
    
    .csimp-stat-item {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .csimp-stat-value {
        color: #f7fafc;
    }
    
    .csimp-btn-secondary {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
}
