/**
 * AI Text Rewriter Frontend Styles - Clean Version
 */

/* Container and Layout */
.atr-container {
    max-width: 1400px;
    margin: 3rem auto;

    
    border-radius: 20px;
}

.atr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: stretch;
}

@media (max-width: 968px) {
    .atr-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Panel Styling */
.atr-panel {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    border: 1px solid #e5e7eb;
}

.atr-panel:hover {
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.1),
        0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Panel Headers - Fixed Vertical Alignment */
.atr-panel-header {
    padding: 1rem 2rem;
    background: #ffffff;
    color: #1f2937;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    border-bottom: 2px solid #e5e7eb;
}

.atr-output-panel .atr-panel-header {
    background: #ffffff;
    border-bottom: 2px solid #e5e7eb;
}

.atr-panel-title {
    margin-top: auto;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #1f2937;
}

/* Word Counter - Fixed Height and Alignment */
.atr-word-count {
    background: #f3f4f6;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    color: #6b7280;
    height: 32px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.atr-word-count-exceeded {
    background: #ff4757;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Panel Body */
.atr-panel-body {
    padding: 2rem;
    background: #ffffff;
}

/* Textarea Styling */
.atr-textarea {
    width: 100%;
    min-height: 350px;
    padding: 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1.05rem;
    line-height: 1.7;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: white;
}

.atr-textarea:focus {
    outline: none;
    border-color: #9ca3af;
}

.atr-textarea::placeholder {
    color: #9ca3af;
}

/* Warning Message */
.atr-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    background: #fef2f2;
    border: 1px solid #feb2b2;
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideInUp 0.4s ease;
}

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

.atr-warning-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

/* Tone Selector */
.atr-tone-selector {
    margin-top: 1.5rem;
}

.atr-tone-selector label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: #1f2937;
    font-size: 0.95rem;
    letter-spacing: -0.25px;
}

.atr-select {
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.atr-select:focus {
    outline: none;
    border-color: #9ca3af;
}

.atr-select:hover {
    border-color: #9ca3af;
}

/* Button Group */
.atr-button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.75rem;
}

/* Buttons - Fixed Alignment and Solid Color */
.atr-btn {
    padding: .5rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: -0.25px;
}

.atr-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button - Solid Color, No Gradient */
.atr-btn-primary {
    background: #6B73FF;
    color: white;
    flex: 1;
    box-shadow: 0 4px 14px rgba(107, 115, 255, 0.25);
}

.atr-btn-primary:not(:disabled):hover {
    background: #5b63ef;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 115, 255, 0.35);
}

.atr-btn-secondary {
    background: #f9fafb;
    color: #4b5563;
    border: 2px solid #e5e7eb;
}

.atr-btn-secondary:hover {
    background: #f3f4f6;
}

/* Button Icon - No Animation */
.atr-btn-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: inline-block;
    vertical-align: middle;
}

/* Copy Button - Same height as word counter */
.atr-copy-btn {
    background: #6B73FF;
    border: 1px solid #5b63ef;
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.25px;
    height: 32px;
}

.atr-copy-btn:hover {
    background: #5b63ef;
}

.atr-copy-btn.atr-copy-success {
    background: #10b981;
}

.atr-copy-icon {
    width: 1.125rem;
    height: 1.125rem;
    vertical-align: middle;
}

/* Output Container */
.atr-output-container {
    min-height: 350px;
    position: relative;
    border-radius: 12px;
    background: #fafbfc;
    padding: 1px;
}

/* Empty State */
.atr-empty-state,
.atr-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 530px;
    text-align: center;
    padding: 3rem 2rem;
}

.atr-empty-icon {
    width: 5rem;
    height: 5rem;
    color: #cbd5e1;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.atr-empty-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #475569;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.5px;
}

.atr-empty-subtext {
    font-size: 0.95rem;
    color: #94a3b8;
    margin: 0;
    font-weight: 400;
}

/* Loading State */
.atr-spinner {
    width: 4rem;
    height: 4rem;
    border: 4px solid #e2e8f0;
    border-top-color: #6B73FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.atr-loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6B73FF;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.5px;
}

.atr-loading-subtext {
    font-size: 0.95rem;
    color: #94a3b8;
    margin: 0;
}

/* Output Text */
.atr-output-text {
    padding: 2rem;
    background: #f0f4ff;
    border-radius: 12px;
    border: 1px solid #c7d2fe;
    line-height: 1.8;
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 1.05rem;
    animation: fadeIn 0.3s ease;
}

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

/* Message Notifications */
.atr-message {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 1.25rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideInRight 0.3s ease;
}

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

.atr-message-success {
    background: #10b981;
    color: white;
}

.atr-message-error {
    background: #ef4444;
    color: white;
}

/* Dark Theme */
.atr-container[data-theme="dark"] {
    background: #1a1b26;
}

.atr-container[data-theme="dark"] .atr-panel {
    background: #1e1f2e;
    border-color: #2a2b3d;
}

.atr-container[data-theme="dark"] .atr-panel-body {
    background: #1e1f2e;
}

.atr-container[data-theme="dark"] .atr-textarea,
.atr-container[data-theme="dark"] .atr-select {
    background: #1a1b26;
    border-color: #414868;
    color: #c0caf5;
}

.atr-container[data-theme="dark"] .atr-textarea::placeholder {
    color: #565f89;
}

.atr-container[data-theme="dark"] .atr-output-text {
    background: #2a2b3d;
    border-color: #414868;
    color: #c0caf5;
}

.atr-container[data-theme="dark"] .atr-btn-secondary {
    background: #414868;
    color: #c0caf5;
    border-color: #565f89;
}

.atr-container[data-theme="dark"] .atr-empty-text {
    color: #a9b1d6;
}

.atr-container[data-theme="dark"] .atr-empty-subtext,
.atr-container[data-theme="dark"] .atr-loading-subtext {
    color: #565f89;
}

.atr-container[data-theme="dark"] .atr-tone-selector label {
    color: #c0caf5;
}

.atr-container[data-theme="dark"] .atr-output-container {
    background: #2a2b3d;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .atr-container {

        border-radius: 15px;
    }
    
    .atr-panel-header {
        padding: 1.25rem 1.5rem;
        min-height: 60px;
    }
    
    .atr-panel-body {
        padding: 1.5rem;
    }
    
    .atr-textarea {
        min-height: 250px;
        font-size: 1rem;
    }
    
    .atr-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .atr-message {
        right: 15px;
        left: 15px;
        top: 15px;
    }
    
    .atr-button-group {
        flex-direction: column;
    }
    
    .atr-button-group .atr-btn {
        width: 100%;
 
}

/* Print Styles */
@media print {
    .atr-container {
        box-shadow: none;
        background: white;
    }
    
    .atr-btn,
    .atr-copy-btn {
        display: none;
    }
}

/* Accessibility Improvements */
.atr-btn:focus-visible {
    outline: 2px solid #6B73FF;
    outline-offset: 2px;
}

.atr-select:focus-visible,
.atr-textarea:focus-visible {
    outline: none;
}

/* Custom Scrollbar */
.atr-textarea::-webkit-scrollbar,
.atr-output-text::-webkit-scrollbar {
    width: 8px;
}

.atr-textarea::-webkit-scrollbar-track,
.atr-output-text::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.atr-textarea::-webkit-scrollbar-thumb,
.atr-output-text::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.atr-textarea::-webkit-scrollbar-thumb:hover,
.atr-output-text::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}