* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.language-selector {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

.language-selector select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.language-selector select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.language-selector option {
    background: #4a5568;
    color: white;
}

.header .logo {
    max-width: 230px;
    height: auto;
    display: block;
    margin: 0 auto 10px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header h1 i {
    color: #ffd700;
    margin-right: 15px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.main-card, .settings-card, .info-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.settings-card {
    padding: 30px;
}

.settings-card h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.settings-card h3 i {
    margin-right: 10px;
    color: #667eea;
}

/* Why section styles */
.why-section h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.why-list {
    list-style: none;
    padding-left: 0;
    margin-top: 8px;
}

.why-list li {
    position: relative;
    padding-left: 28px;
    margin: 8px 0;
    color: #4a5568;
}

.why-list li::before {
    content: '✔';
    position: absolute;
    left: 0;
    top: 0;
    color: #48bb78;
    font-weight: 700;
}

.input-section, .review-section {
    margin-bottom: 30px;
}

.setting-item {
    margin-bottom: 20px;
}

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

textarea, input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    resize: vertical;
}

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

textarea {
    min-height: 120px;
    line-height: 1.6;
}

#generated-review {
    min-height: 160px;
}

.generate-section {
    text-align: center;
    margin: 60px 0;
    padding: 40px 0;
}

.btn-primary, .btn-secondary, .btn-success {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1rem;
    padding: 18px 40px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

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

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(72, 187, 120, 0.4);
}

.review-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-overlay p {
    font-size: 1.1rem;
    font-weight: 500;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid #48bb78;
}

.toast.error {
    border-left: 4px solid #f56565;
}

/* Tutorial Overlay Styles */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    animation: fadeIn 0.3s ease;
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.tutorial-highlight {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid #4299e1;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 0 0 30px rgba(66, 153, 225, 0.6);
    transition: all 0.4s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 0 0 30px rgba(66, 153, 225, 0.6);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 0 0 40px rgba(66, 153, 225, 0.9);
    }
}

.tutorial-tooltip {
    position: absolute;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 410px;
    z-index: 10001;
    animation: slideIn 0.4s ease;
}

.tutorial-tooltip.rtl {
    direction: rtl;
    text-align: right;
}

.tutorial-tooltip h3 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.tutorial-tooltip p {
    color: #4a5568;
    margin-bottom: 15px;
    line-height: 1.5;
}

.tutorial-controls {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.tutorial-step {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

.tutorial-nav {
    display: flex;
    gap: 8px;
}

.tutorial-btn {
    padding: 8px 16px;
    border: none !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    outline: none !important;
}

.tutorial-btn.primary {
    background: #4299e1;
    color: white;
}

/* Ensure anchors keep correct color when visited */
.tutorial-btn.primary:visited {
    color: white;
}

.tutorial-btn:hover {
    text-decoration: none;
}

.tutorial-btn.primary:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.tutorial-btn.secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.tutorial-btn.secondary:visited {
    color: #4a5568;
}

.tutorial-btn:focus,
.tutorial-btn:focus-visible,
.tutorial-btn:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Redundant guards for specificity across engines */
button.tutorial-btn,
button.tutorial-btn:focus,
button.tutorial-btn:focus-visible,
button.tutorial-btn:active,
a.tutorial-btn,
a.tutorial-btn:focus,
a.tutorial-btn:focus-visible,
a.tutorial-btn:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Remove Firefox's inner focus border/padding */
button.tutorial-btn::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* Remove WebKit's inner focus outline/padding */
button.tutorial-btn::-webkit-focus-inner {
    border: 0;
    padding: 0;
}

.tutorial-btn.secondary:hover {
    background: #cbd5e0;
}

.tutorial-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 10002;
}

.tutorial-arrow.top {
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 20px solid white;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.tutorial-arrow.bottom {
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 20px solid white;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.tutorial-arrow.left {
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 20px solid white;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.tutorial-arrow.right {
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 20px solid white;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.tutorial-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #4299e1;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(66, 153, 225, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    animation: bounce 2s infinite;
}

.tutorial-trigger:hover {
    background: #3182ce;
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(66, 153, 225, 0.6);
}

/* RTL adjustments when language is Hebrew */
html[dir="rtl"] .why-section h3,
html[dir="rtl"] .why-section p,
html[dir="rtl"] .why-list {
    text-align: right;
}

html[dir="rtl"] .why-list li {
    padding-right: 28px;
    padding-left: 0;
}

html[dir="rtl"] .why-list li::before {
    right: 0;
    left: auto;
}

html[dir="rtl"] .header h1 i {
    margin-left: 15px;
    margin-right: 0;
}

/* General RTL form alignment */
html[dir="rtl"] label {
    text-align: right;
}

html[dir="rtl"] textarea,
html[dir="rtl"] input {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .language-selector select {
    direction: rtl;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
    60% {
        transform: translateY(-4px);
    }
}

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

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

/* Mobile Responsive Tutorial */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: 280px;
        padding: 15px;
    }
    
    .tutorial-tooltip h3 {
        font-size: 1rem;
    }
    
    .tutorial-tooltip p {
        font-size: 0.9rem;
    }
    
    .tutorial-trigger {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

.toast i {
    font-size: 1.2rem;
}

.toast.success i {
    color: #48bb78;
}

.toast.error i {
    color: #f56565;
}

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

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .main-card, .settings-card {
        padding: 25px;
    }
    
    .header .logo {
        max-width: 170px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .review-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary, .btn-success {
        width: 100%;
        justify-content: center;
    }
    
    .toast {
        min-width: auto;
        width: calc(100vw - 40px);
    }
}
