/* AI Text Transformer Studio - Modern Styling */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #20C997, #17a589);
    --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: #1e1e2e;
        --text-primary: #e4e4e4;
        --text-secondary: #a8a8a8;
        --border-color: #2d3748;
    }
}

/* Hero Section */
.transformer-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    position: relative;
    overflow: hidden;
}

.transformer-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: ripple 15s linear infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes ripple {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Main Container */
.transformer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    gap: 2rem;
    animation: fadeInUp 0.6s ease;
}

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.6s ease;
    max-width: 100%;
    overflow: hidden;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.char-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#inputText {
    width: 100%;
    max-width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quick-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #2c3e50;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

/* Tools Section */
.tools-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.6s ease 0.1s both;
    max-width: 100%;
    overflow: hidden;
}

.tools-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tool-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tool-tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.tool-tab.active {
    background: var(--primary-gradient);
    color: white;
}

/* Tool Panels */
.tool-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tool-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tool-panel h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

/* Tone Options */
.tone-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.tone-btn, .style-btn {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.tone-btn::before, .style-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.tone-btn:hover::before, .style-btn:hover::before {
    width: 300px;
    height: 300px;
}

.tone-btn:hover, .style-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tone-btn:active, .style-btn:active {
    transform: translateY(0);
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.language-select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

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

.transform-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    background: var(--success-gradient);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

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

.full-width-btn {
    width: 100%;
    margin-top: 1.5rem;
    box-sizing: border-box;
}

/* Summarizer Options */
.summarizer-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.option-label:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.option-label input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Rewriter Styles */
.rewriter-styles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* Output Section */
.output-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.6s ease 0.2s both;
    max-width: 100%;
    overflow: hidden;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.output-container {
    min-height: 300px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    margin: 0.5rem 0;
}

.empty-hint {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Output Content */
.output-content {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 12px;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    animation: fadeInScale 0.6s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid var(--border-color);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-state p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* History Section */
.history-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.6s ease 0.3s both;
}

.clear-history-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: #dc3545;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.clear-history-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: #c82333;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-history {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.history-item {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), transparent);
    border-left: 4px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    animation: slideIn 0.4s ease;
}

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

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.history-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-tool {
    font-weight: 600;
    color: #667eea;
}

.history-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .transformer-container {
        padding: 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .input-section,
    .tools-section,
    .output-section,
    .history-section {
        padding: 1rem;
        max-width: 100%;
        box-sizing: border-box;
    }

    .tools-tabs {
        flex-direction: column;
        max-width: 100%;
    }

    .tool-tab {
        width: 100%;
        box-sizing: border-box;
    }

    .tone-options, .rewriter-styles {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .tone-btn, .style-btn {
        width: 100%;
        box-sizing: border-box;
    }

    .language-selector {
        flex-direction: column;
        max-width: 100%;
    }

    .language-select {
        width: 100%;
        box-sizing: border-box;
    }

    .transform-btn {
        width: 100%;
        box-sizing: border-box;
        padding: 0.75rem 1rem;
    }

    .quick-actions {
        flex-direction: column;
        max-width: 100%;
    }

    .quick-btn {
        width: 100%;
        box-sizing: border-box;
    }

    .output-actions {
        flex-direction: column;
        max-width: 100%;
    }

    .action-btn {
        width: 100%;
        box-sizing: border-box;
    }

    #inputText {
        max-width: 100%;
        box-sizing: border-box;
    }

    .output-content {
        max-width: 100%;
        box-sizing: border-box;
        padding: 1rem;
    }
}

/* Success Animation */
@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.success-animation {
    animation: successPulse 0.6s ease;
}

/* Copy Feedback */
.copy-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--success-gradient);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.4s ease, slideOutRight 0.4s ease 2.6s;
    z-index: 9999;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}
