/* Tamil Typing Tool Styles */

/* Custom Fonts */
@font-face {
    font-family: 'Always In My Heart';
    src: url('../fonts/AlwaysInMyHeart.ttf') format('truetype');
}

@font-face {
    font-family: 'Better Together';
    src: url('../fonts/BetterTogether.ttf') format('truetype');
}

@font-face {
    font-family: 'Bite Chocolate';
    src: url('../fonts/BiteChocolate.ttf') format('truetype');
}

@font-face {
    font-family: 'Bitter Robusta';
    src: url('../fonts/BitterRobusta.ttf') format('truetype');
}

@font-face {
    font-family: 'Lofty Goals';
    src: url('../fonts/loftygoals.otf') format('opentype');
}

@font-face {
    font-family: 'My Happy Ending';
    src: url('../fonts/MyHappyEnding.ttf') format('truetype');
}

@font-face {
    font-family: 'Tomatoes';
    src: url('../fonts/tomatoes.ttf') format('truetype');
}

@font-face {
    font-family: 'Xiomara';
    src: url('../fonts/Xiomara.ttf') format('truetype');
}

/* Main Wrapper */
.tamil-typing-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 200px);
}

.tamil-typing-container {
    width: 100%;
}

/* Header */
.tamil-typing-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

.tamil-typing-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 10px;
    font-family: 'Noto Sans Tamil', 'Inter', sans-serif;
}

.tamil-typing-header p {
    font-size: 16px;
    color: var(--text-secondary, #666);
}

/* Editor Container */
.tamil-typing-editor-container {
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid var(--border-color, #e5e5e5);
}

/* Toolbar */
.tamil-typing-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 15px;
    background: var(--toolbar-bg, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #e5e5e5);
    gap: 5px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color, #ddd);
    margin: 0 8px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary, #333);
}

.toolbar-btn:hover {
    background: var(--hover-bg, #e9ecef);
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: var(--active-bg, #d1e7dd);
}

.toolbar-btn svg {
    fill: currentColor;
}

.toolbar-select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary, #333);
    min-width: 100px;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
}

/* Font Size Group */
.font-size-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.font-size-input {
    width: 45px;
    height: 36px;
    text-align: center;
    border: 1px solid var(--border-color, #ddd);
    border-left: none;
    border-right: none;
    font-size: 14px;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #333);
}

.font-size-input:focus {
    outline: none;
}

.font-size-group .toolbar-btn:first-child {
    border-radius: 8px 0 0 8px;
    border: 1px solid var(--border-color, #ddd);
}

.font-size-group .toolbar-btn:last-child {
    border-radius: 0 8px 8px 0;
    border: 1px solid var(--border-color, #ddd);
}

/* Dropdown */
.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    width: auto;
    padding: 0 10px;
}

.dropdown-arrow {
    fill: currentColor;
    opacity: 0.6;
}

.toolbar-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    display: none;
    min-width: 120px;
    overflow: hidden;
}

.toolbar-dropdown.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary, #333);
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--hover-bg, #f0f0f0);
}

/* Color Button */
.color-btn {
    position: relative;
}

.color-btn::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 8px;
    right: 8px;
    height: 3px;
    background: #000;
    border-radius: 2px;
}

/* Editor Area */
.tamil-typing-editor-area {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
}

.editor-content {
    min-height: 400px;
    padding: 30px;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary, #1a1a1a);
    font-family: 'Noto Sans Tamil', 'Inter', sans-serif;
    outline: none;
}

.editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--placeholder-color, #999);
    pointer-events: none;
}

.editor-content:focus {
    outline: none;
}

/* Bottom Bar */
.tamil-typing-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--toolbar-bg, #f8f9fa);
    border-top: 1px solid var(--border-color, #e5e5e5);
}

/* Language Toggle */
.language-toggle {
    display: flex;
    background: var(--toggle-bg, #e9ecef);
    border-radius: 25px;
    padding: 4px;
}

.lang-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    transition: all 0.3s ease;
    font-family: 'Noto Sans Tamil', 'Inter', sans-serif;
}

.lang-btn.active {
    background: var(--primary-color, #4CAF50);
    color: #fff;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.lang-btn:hover:not(.active) {
    background: var(--hover-bg, #ddd);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--border-color, #ddd);
    background: var(--card-bg, #fff);
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #333);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--hover-bg, #f0f0f0);
    border-color: var(--primary-color, #4CAF50);
}

.action-btn svg {
    fill: currentColor;
}

.expand-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

/* Expanded (Fullscreen) State */
.tamil-typing-editor-container.expanded {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.tamil-typing-editor-container.expanded .tamil-typing-editor-area {
    flex: 1 !important;
    max-height: none !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow-y: auto !important;
}

.tamil-typing-editor-container.expanded .editor-content {
    min-height: 100% !important;
    height: 100% !important;
}

.tamil-typing-editor-container.expanded .expand-btn svg {
    transform: rotate(180deg);
}

/* Voice Typing Active State */
.action-btn.recording {
    background: #ff4444;
    color: #fff;
    border-color: #ff4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
}

/* Info Section */
.tamil-typing-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.info-card {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color, #e5e5e5);
}

.info-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 15px;
}

.info-card p {
    font-size: 14px;
    color: var(--text-secondary, #666);
    margin-bottom: 12px;
    line-height: 1.6;
}

.info-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-card ul li {
    font-size: 14px;
    color: var(--text-secondary, #666);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, #eee);
}

.info-card ul li:last-child {
    border-bottom: none;
}

.info-card ul li strong {
    color: var(--primary-color, #4CAF50);
    font-family: monospace;
}

/* Footer */
.tof-footer {
    background: var(--footer-bg, #f8f9fa);
    padding: 40px 20px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color, #e5e5e5);
}

.tof-footer-container {
    max-width: 1000px;
    margin: 0 auto;
}

.tof-footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.tof-footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.tof-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.tof-footer-links a {
    color: var(--text-secondary, #666);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.tof-footer-links a:hover {
    color: var(--primary-color, #4CAF50);
}

.tof-footer-copyright {
    font-size: 13px;
    color: var(--text-secondary, #888);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --card-bg: #1e1e1e;
    --toolbar-bg: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --border-color: #404040;
    --hover-bg: #3d3d3d;
    --active-bg: #2e5a3d;
    --toggle-bg: #3d3d3d;
    --primary-color: #66bb6a;
    --placeholder-color: #666;
    --footer-bg: #1a1a1a;
}

/* Dark Mode Table Styles */
[data-theme="dark"] .editor-content table,
[data-theme="dark"] .editor-content table td,
[data-theme="dark"] .editor-content table th,
[data-theme="dark"] .editable-table,
[data-theme="dark"] .editable-table td,
[data-theme="dark"] .editable-table th {
    color: #ffffff !important;
    background-color: #2d2d2d;
    border-color: #555 !important;
}

[data-theme="dark"] .editor-content table td:focus,
[data-theme="dark"] .editable-table td:focus {
    background-color: #3d3d3d;
    outline: 2px solid #66bb6a;
}

[data-theme="dark"] .editable-table-wrapper .table-edit-btn {
    background: #66bb6a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tamil-typing-wrapper {
        padding: 10px;
    }

    .tamil-typing-header h1 {
        font-size: 22px;
    }

    .tamil-typing-toolbar {
        padding: 8px 10px;
        justify-content: center;
    }

    .toolbar-divider {
        display: none;
    }

    .toolbar-select {
        min-width: 80px;
        font-size: 12px;
    }

    .tamil-typing-bottom-bar {
        flex-direction: column;
        gap: 15px;
    }

    .language-toggle {
        width: 100%;
        justify-content: center;
    }

    .action-buttons {
        width: 100%;
        justify-content: center;
    }

    .action-btn span {
        display: none;
    }

    .action-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .editor-content {
        padding: 20px;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .tamil-typing-header {
        padding: 15px 10px;
    }

    .tamil-typing-header h1 {
        font-size: 18px;
    }

    .tamil-typing-header p {
        font-size: 14px;
    }

    .font-size-group {
        display: none;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
    }

    .toolbar-btn svg {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px;
        min-height: 18px;
    }

    .dropdown-btn {
        min-width: 45px;
    }

    .dropdown-arrow {
        width: 14px !important;
        height: 14px !important;
    }

    .lang-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Scrollbar Styling */
.tamil-typing-editor-area::-webkit-scrollbar {
    width: 8px;
}

.tamil-typing-editor-area::-webkit-scrollbar-track {
    background: var(--toolbar-bg, #f1f1f1);
}

.tamil-typing-editor-area::-webkit-scrollbar-thumb {
    background: var(--border-color, #ccc);
    border-radius: 4px;
}

.tamil-typing-editor-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #999);
}

/* Print Styles */
@media print {

    .tamil-typing-toolbar,
    .tamil-typing-bottom-bar,
    .tamil-typing-header,
    .tamil-typing-info,
    .tof-navbar,
    .tof-footer {
        display: none !important;
    }

    .tamil-typing-editor-container {
        box-shadow: none;
        border: none;
    }

    .editor-content {
        padding: 0;
    }
}

/* Tamil Suggestion Dropdown Styles */
.tamil-suggestion-dropdown {
    position: absolute;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    max-width: 280px;
    overflow: hidden;
    display: none;
    font-family: 'Noto Sans Tamil', 'Inter', sans-serif;
}

.tamil-suggestion-dropdown.show {
    display: block;
}

.suggestion-input-display {
    padding: 10px 15px;
    background: var(--toolbar-bg, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 14px;
    color: var(--text-secondary, #666);
    font-weight: 500;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 16px;
    color: var(--text-primary, #333);
    border-bottom: 1px solid var(--border-color, #f0f0f0);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--hover-bg, #f5f5f5);
}

.suggestion-item.selected {
    background: #e8f5e9;
    color: #2e7d32;
}

[data-theme="dark"] .suggestion-item.selected {
    background: #1b5e20;
    color: #a5d6a7;
}

.suggestion-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--border-color, #e0e0e0);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    color: var(--text-secondary, #666);
    flex-shrink: 0;
}

.suggestion-item.selected .suggestion-number {
    background: #4CAF50;
    color: #fff;
}

.suggestion-text {
    flex: 1;
    font-size: 18px;
}

.suggestion-item.english-option {
    background: var(--toolbar-bg, #fafafa);
    font-style: italic;
    color: var(--text-secondary, #888);
}

.suggestion-item.english-option .suggestion-text {
    font-size: 15px;
}

/* Dark mode adjustments */
[data-theme="dark"] .tamil-suggestion-dropdown {
    background: #2d2d2d;
    border-color: #444;
}

[data-theme="dark"] .suggestion-input-display {
    background: #3d3d3d;
    border-color: #444;
}

[data-theme="dark"] .suggestion-item {
    border-color: #3d3d3d;
}

[data-theme="dark"] .suggestion-item:hover {
    background: #3d3d3d;
}

[data-theme="dark"] .suggestion-number {
    background: #444;
}