/* ===========================
   Modern Arabic Keyboard Styles
   =========================== */

/* CSS Reset & Base Styles */
* {
    box-sizing: border-box;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* App Detail Section */
#app-detail {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    padding: 40px 0;
}

.app {
    width: 100%;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 0;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

.app-title {
    text-align: center;
    color: #2d3748;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
}

.arabic-subtitle {
    display: block;
    color: #667eea;
    font-size: clamp(1rem, 3vw, 1.5rem);
    margin-top: 10px;
    font-weight: 600;
}

/* Keyboard Section */
.keyboard-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
}

/* Writing Area */
.writing-area {
    margin-bottom: 30px;
}

#writingbox {
    width: 100%;
    height: 200px;
    padding: 20px;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Times New Roman', Times, serif;
    font-size: clamp(18px, 2.5vw, 24px);
    color: #2d3748;
    direction: rtl;
    text-align: right;
    background: #f7fafc;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 150px;
}

#writingbox:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

#writingbox::placeholder {
    color: #a0aec0;
    opacity: 0.6;
}

/* Controls Bar */
#vor-key {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#autoisn {
    display: flex;
    align-items: center;
    gap: 10px;
}

#text {
    color: white;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 500;
}

.toggle-label {
    margin-right: 10px;
}

.toggle-status {
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.toggle-status.active {
    background: #48bb78;
    color: white;
}

.toggle-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#offisn {
    color: white;
}

#font-display {
    display: none;
}

/* Keyboard */
#keyboard {
    background: linear-gradient(135deg, #434343 0%, #2d2d2d 100%);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    margin-top: 25px;
    direction: rtl;
    text-align: center;
}

.keyboard-row {
    margin-bottom: 12px;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

/* Key Groups */
.key-group {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px;
    border-radius: 10px;
}

.key-group span {
    display: flex;
    direction: rtl;
}

.key-group.diacritics {
    background: rgba(102, 126, 234, 0.2);
}

.key-group.numbers {
    background: rgba(118, 75, 162, 0.2);
}

.key-group.letters {
    background: rgba(255, 255, 255, 0.08);
}

.key-group.controls {
    background: transparent;
    padding: 8px;
}

/* Buttons */
.key-btn {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    color: #2d3748;
    border: none;
    border-radius: 6px;
    padding: 10px;
    margin: 3px;
    width: 35px;
    height: 35px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), 
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.key-btn:hover {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.key-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.key-btn.diacritic {
    background: linear-gradient(145deg, #fef5e7, #fdebd0);
    font-size: 22px;
    color: #d35400;
}

.key-btn.diacritic:hover {
    background: linear-gradient(145deg, #f39c12, #e67e22);
    color: white;
}

.key-btn.key-lg {
    width: 52px;
}

/* Space and Control Buttons */
#space {
    width: 400px;
    max-width: 70%;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 1px;
}

#space:hover {
    background: linear-gradient(145deg, #5568d3, #6a3f8f);
}

#back,
.control-btn {
    width: 80px;
    background: linear-gradient(145deg, #fc8181, #f56565);
    color: white;
}

#back:hover,
.control-btn:hover {
    background: linear-gradient(145deg, #e53e3e, #c53030);
}

/* Help Section */
.help-section {
    margin-top: 40px;
    direction: rtl;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.help-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-align: right;
}

.help-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.2);
}

.help-card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    margin-right: auto;
}

.help-card-icon svg {
    color: white;
}

.help-card h3 {
    color: #2d3748;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.help-card p {
    color: #4a5568;
    line-height: 1.8;
    margin: 0;
    font-size: 1rem;
}

/* Conversion Examples */
.conversion-examples {
    margin-top: 20px;
}

.example-row {
    display: inline-block;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.example-row:hover {
    background: #edf2f7;
    transform: translateX(-5px);
}

.latin-char {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-family: monospace;
    font-size: 18px;
    min-width: 50px;
    text-align: center;
}

.arrow {
    color: #a0aec0;
    font-size: 20px;
    font-weight: bold;
}

.arabic-char {
    background: #764ba2;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-family: 'Times New Roman', serif;
    font-size: 22px;
    min-width: 50px;
    text-align: center;
}

/* Description Section */
.description-section {
    margin-top: 30px;
}

.description-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    line-height: 1.8;
}

.description-card p {
    color: #4a5568;
    margin: 0 0 15px 0;
    font-size: 1rem;
}

.description-card p:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .keyboard-section {
        padding: 20px;
    }
    
    #keyboard {
        padding: 20px;
    }
    
    .key-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        padding: 8px;
    }
    
    .key-btn.key-lg {
        width: 45px;
    }
}

@media (max-width: 768px) {
    #app-detail {
        padding: 20px 0;
    }
    
    .app-header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .keyboard-section {
        padding: 15px;
    }
    
    #writingbox {
        height: 150px;
        font-size: 18px;
        padding: 15px;
    }
    
    #vor-key {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    #keyboard {
        padding: 15px;
    }
    
    .key-group {
        padding: 8px;
        margin: 3px;
    }
    
    .key-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
        padding: 6px;
        margin: 2px;
    }
    
    .key-btn.key-lg {
        width: 38px;
    }
    
    .key-btn.diacritic {
        font-size: 18px;
    }
    
    #space {
        width: 90%;
        font-size: 14px;
    }
    
    #back,
    .control-btn {
        width: 60px;
    }
    
    .help-grid {
        grid-template-columns: 1fr;
    }
    
    .help-card {
        padding: 20px;
    }
    
    .help-card-icon {
        width: 50px;
        height: 50px;
    }
    
    .help-card-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .help-card h3 {
        font-size: 1.25rem;
    }
    
    .example-row {
        padding: 10px;
    }
    
    .latin-char,
    .arabic-char {
        padding: 6px 12px;
        font-size: 16px;
        min-width: 40px;
    }
    
    .description-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .keyboard-section {
        padding: 10px;
        border-radius: 12px;
    }
    
    #keyboard {
        padding: 10px;
    }
    
    .key-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
        padding: 4px;
        margin: 1px;
    }
    
    .key-btn.key-lg {
        width: 33px;
    }
    
    .key-btn.diacritic {
        font-size: 16px;
    }
    
    .key-group {
        padding: 6px;
        margin: 2px;
    }
    
    #space {
        font-size: 12px;
        padding: 8px;
    }
    
    #back,
    .control-btn {
        width: 50px;
        font-size: 14px;
    }
    
    .control-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.keyboard-section,
.help-card,
.description-card {
    animation: fadeIn 0.6s ease-out;
}

/* Accessibility */
.key-btn:focus,
#writingbox:focus,
.toggle-status:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    #keyboard,
    .help-section {
        display: none;
    }
    
    #writingbox {
        border: 2px solid #000;
        background: white;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}