/**
 * TalkGenAI Frontend Styles
 * Styles for shortcode-rendered apps on the frontend
 */

/* App Container */
.talkgenai-app-container {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

/* Ensure apps are responsive */
.talkgenai-app-container * {
    box-sizing: border-box;
}

/* Reset some common styles that might interfere */
.talkgenai-app-container img {
    max-width: 100%;
    height: auto;
}

.talkgenai-app-container table {
    width: 100%;
    border-collapse: collapse;
}

/* Common app styles */
.talkgenai-app-container .app-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.talkgenai-app-container .app-content {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Button styles */
.talkgenai-app-container button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.talkgenai-app-container button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.talkgenai-app-container button:active {
    transform: translateY(0);
}

/* Input styles */
.talkgenai-app-container input,
.talkgenai-app-container textarea,
.talkgenai-app-container select {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.talkgenai-app-container input:focus,
.talkgenai-app-container textarea:focus,
.talkgenai-app-container select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

/* Calculator specific styles */
.talkgenai-app-container .calculator {
    max-width: 400px;
    margin: 0 auto;
}

.talkgenai-app-container .calculator-display {
    background: #000;
    color: #fff;
    padding: 20px;
    text-align: right;
    font-size: 2em;
    font-family: 'Courier New', monospace;
    border-radius: 8px 8px 0 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.talkgenai-app-container .calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #ddd;
}

.talkgenai-app-container .calculator-button {
    background: #f9f9f9;
    border: none;
    padding: 20px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.talkgenai-app-container .calculator-button:hover {
    background: #e9e9e9;
}

.talkgenai-app-container .calculator-button.operator {
    background: #ff9500;
    color: white;
}

.talkgenai-app-container .calculator-button.operator:hover {
    background: #e6850e;
}

/* Timer specific styles */
.talkgenai-app-container .timer {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.talkgenai-app-container .timer-display {
    font-size: 4em;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    margin: 30px 0;
    color: #333;
}

.talkgenai-app-container .timer-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.talkgenai-app-container .timer-button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    min-width: 100px;
}

.talkgenai-app-container .timer-button.start {
    background: #28a745;
    color: white;
}

.talkgenai-app-container .timer-button.pause {
    background: #ffc107;
    color: #333;
}

.talkgenai-app-container .timer-button.stop {
    background: #dc3545;
    color: white;
}

.talkgenai-app-container .timer-button.reset {
    background: #6c757d;
    color: white;
}

/* Todo specific styles */
.talkgenai-app-container .todo-app {
    max-width: 600px;
    margin: 0 auto;
}

.talkgenai-app-container .todo-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.talkgenai-app-container .todo-input input {
    flex: 1;
    padding: 12px;
    font-size: 16px;
}

.talkgenai-app-container .todo-input button {
    padding: 12px 20px;
    background: #0073aa;
    color: white;
    font-weight: bold;
}

.talkgenai-app-container .todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.talkgenai-app-container .todo-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
    transition: all 0.3s ease;
}

.talkgenai-app-container .todo-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.talkgenai-app-container .todo-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.talkgenai-app-container .todo-checkbox {
    margin-right: 15px;
    transform: scale(1.2);
}

.talkgenai-app-container .todo-text {
    flex: 1;
    font-size: 16px;
}

.talkgenai-app-container .todo-delete {
    background: #dc3545;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 15px;
}

/* Form specific styles */
.talkgenai-app-container .form-app {
    max-width: 700px;
    margin: 0 auto;
}

.talkgenai-app-container .form-group {
    margin-bottom: 20px;
}

.talkgenai-app-container .form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.talkgenai-app-container .form-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.talkgenai-app-container .form-input:focus {
    border-color: #0073aa;
}

.talkgenai-app-container .form-submit {
    background: #0073aa;
    color: white;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 6px;
    width: 100%;
}

/* Game specific styles */
.talkgenai-app-container .game-app {
    max-width: 600px;
    margin: 0 auto;
}

.talkgenai-app-container .game-board {
    display: grid;
    gap: 5px;
    margin: 20px 0;
    justify-content: center;
}

.talkgenai-app-container .game-cell {
    width: 60px;
    height: 60px;
    border: 2px solid #333;
    background: #fff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.talkgenai-app-container .game-cell:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.talkgenai-app-container .game-score {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin: 20px 0;
}


/* Comparison Table styles - REMOVED: Managed by Python Service */


/* Responsive design */
@media screen and (max-width: 768px) {
    .talkgenai-app-container {
        margin: 10px 0;
    }
    
    .talkgenai-app-container .app-content {
        padding: 15px;
        border-radius: 6px;
    }
    
    .talkgenai-app-container .calculator-display {
        font-size: 1.5em;
        padding: 15px;
    }
    
    .talkgenai-app-container .calculator-button {
        padding: 15px;
        font-size: 16px;
    }
    
    .talkgenai-app-container .timer-display {
        font-size: 2.5em;
        margin: 20px 0;
    }
    
    .talkgenai-app-container .timer-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .talkgenai-app-container .timer-button {
        min-width: 80px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .talkgenai-app-container .todo-input {
        flex-direction: column;
    }
    
    .talkgenai-app-container .todo-item {
        padding: 12px;
    }
    
    .talkgenai-app-container .game-cell {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media screen and (max-width: 480px) {
    .talkgenai-app-container .calculator {
        max-width: 100%;
    }
    
    .talkgenai-app-container .calculator-display {
        font-size: 1.2em;
        padding: 10px;
    }
    
    .talkgenai-app-container .calculator-button {
        padding: 12px;
        font-size: 14px;
    }
    
    .talkgenai-app-container .timer-display {
        font-size: 2em;
    }
    
    .talkgenai-app-container .game-cell {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .talkgenai-app-container .app-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .talkgenai-app-container input,
    .talkgenai-app-container textarea,
    .talkgenai-app-container select {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .talkgenai-app-container .todo-item {
        background: #4a5568;
        border-color: #718096;
    }
    
    .talkgenai-app-container .calculator-button {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .talkgenai-app-container .calculator-button:hover {
        background: #718096;
    }
    
    .talkgenai-app-container .game-cell {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
}

/* Print styles */
@media print {
    .talkgenai-app-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .talkgenai-app-container button {
        display: none;
    }
    
    .talkgenai-app-container .timer-controls,
    .talkgenai-app-container .todo-input {
        display: none;
    }
}

/* Accessibility improvements */
.talkgenai-app-container button:focus,
.talkgenai-app-container input:focus,
.talkgenai-app-container textarea:focus,
.talkgenai-app-container select:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.talkgenai-app-container .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animation classes */
.talkgenai-fade-in {
    animation: talkgenai-fadeIn 0.5s ease-in;
}

.talkgenai-slide-in {
    animation: talkgenai-slideIn 0.3s ease-out;
}

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

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

