/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #fafafa;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100vh;
    box-sizing: border-box;
}

/* Title */
.title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: #8b5cf6;
    font-weight: 700;
}

/* Back/Logout Button */
.logout-button {
    background-color: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-button:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

/* Button Grid - Pixel Girl Style */
.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: auto;
    align-items: start;
    justify-content: center;
}

.menu-button {
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    height: 140px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
    color: #374151;
    gap: 0.75rem;
}

.menu-button:hover:enabled {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    border-color: #8b5cf6;
}

.menu-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f9fafb;
    color: #9ca3af;
    box-shadow: none;
}

.button-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.button-text {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Tool Section */
.tool-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.back-button {
    background-color: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    color: #374151;
    font-weight: 500;
}

.back-button:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

.tool-title {
    font-size: 1.25rem;
    color: #8b5cf6;
    margin: 0;
    font-weight: 600;
}

/* AI Input Section */
.ai-input-container {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.question-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    outline: none;
}

.question-input:focus {
    border-color: #8b5cf6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.question-input::placeholder {
    color: #9ca3af;
}

.ask-button {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 70px;
    justify-content: center;
    font-family: 'Inter', sans-serif;
}

.ask-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.ask-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

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

.input-hint {
    color: #6b7280;
    font-size: 0.8rem;
    text-align: center;
    margin: 0;
}

/* Questions Container */
.questions-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.welcome-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    color: #8b5cf6;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.welcome-message p {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* Question Cards */
.question-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.question-card.new-question {
    animation: slideInFromTop 0.4s ease-out;
}

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

.question-header {
    background: #f8f9fa;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.question-header.clickable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.question-header.clickable:hover {
    background: #f1f5f9;
}

.question-text {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.4;
    flex: 1;
}

.question-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.expand-indicator {
    color: #8b5cf6;
    font-size: 0.75rem;
    font-weight: 600;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.question-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    white-space: nowrap;
}

.question-status.thinking {
    background-color: #fef3c7;
    color: #d97706;
}

.question-status.ready {
    background-color: #d1fae5;
    color: #059669;
}

.question-status.error {
    background-color: #fee2e2;
    color: #dc2626;
}

.delete-button {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-button:hover {
    color: #ef4444;
    background-color: #fef2f2;
}

.answer-content {
    padding: 1.25rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.answer-content.show {
    max-height: 1000px;
    opacity: 1;
}

.answer-text {
    color: #374151;
    line-height: 1.6;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.question-timestamp {
    color: #9ca3af;
    font-size: 0.75rem;
    text-align: right;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

/* Timer Module Styles */
.timer-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.timer-input-section {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timer-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.timer-input {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    width: 80px;
    font-family: 'Inter', sans-serif;
    color: #8b5cf6;
}

.timer-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.timer-label {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 500;
}

.task-input {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    outline: none;
    text-align: center;
}

.task-input:focus {
    border-color: #8b5cf6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.task-select {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.task-select:focus {
    border-color: #8b5cf6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.task-select option {
    padding: 0.5rem;
    background-color: white;
}

.task-toggle-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    margin-top: 0.5rem;
}

.task-toggle-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
}

#task-selector-container,
#manual-task-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem 0 0.5rem 0;
}

.timer-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.start-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.start-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pause-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.pause-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.reset-btn {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.reset-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.timer-display-section {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.timer-display {
    font-size: 3rem;
    font-weight: 700;
    color: #8b5cf6;
    margin-bottom: 0.5rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.02em;
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    cursor: text;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
}

.timer-display:hover {
    background: #f9fafb;
}

.timer-display:focus {
    background: #f3f4f6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.current-task {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 0.5rem;
    font-weight: 500;
    min-height: 1.5rem;
}

.timer-status {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* Achievement Bars */
.achievement-bar {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.achievements-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.achievement-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    text-align: center;
}

.achievement-progress {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    max-width: 400px;
    margin: 0 auto;
}

/* Task achievements use flexible layout */
#task-achievement-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.achievement-slot {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.achievement-slot.earned {
    transform: scale(1.05);
}

/* Dodecagon shape using clip-path */
.achievement-dodecagon {
    width: 32px;
    height: 32px;
    clip-path: polygon(
        30% 0%, 70% 0%, 
        100% 30%, 100% 70%, 
        70% 100%, 30% 100%, 
        0% 70%, 0% 30%
    );
    transition: transform 0.3s ease;
}

.achievement-dodecagon:hover {
    transform: scale(1.1);
}

/* Dynamic polygon shapes using clip-path */
.achievement-shape {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.achievement-shape:hover {
    transform: scale(1.1);
}

/* Task completion section */
.task-complete-section {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.complete-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.complete-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.complete-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tooltip for triangle achievements */
.achievement-triangle[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 0.5rem;
}

.achievement-triangle[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    z-index: 10;
    margin-bottom: -4px;
}

.achievement-slot {
    position: relative;
}

/* Shape container with delete button */
.achievement-shape-container {
    position: relative;
    display: inline-block;
}

.delete-shape-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    z-index: 5;
}

.delete-shape-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.achievement-shape-container:hover .delete-shape-btn {
    display: flex;
}

/* Dodecagon container with delete button */
.achievement-dodecagon-container {
    position: relative;
    display: inline-block;
}

.delete-dodecagon-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    z-index: 5;
}

.delete-dodecagon-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.achievement-dodecagon-container:hover .delete-dodecagon-btn {
    display: flex;
}

/* Authentication Styles */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-container {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 3rem 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

#google-signin-button {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    min-height: 50px;
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.auth-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.auth-subtitle {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.user-email {
    font-size: 0.9rem;
    color: #6b7280;
    padding: 0.375rem 0.75rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
}

.logout-button {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* Quote Bar */
.quote-bar {
    background-color: #f8f9fa;
    padding: 0.875rem;
    text-align: center;
    font-size: 0.8rem;
    border-top: 2px solid #e5e7eb;
    color: #6b7280;
    margin-top: auto;
    border-radius: 8px;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
        height: 100vh;
    }
    
    .title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .button-grid {
        gap: 0.75rem;
    }
    
    .menu-button {
        height: 120px;
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .button-icon {
        font-size: 1.75rem;
    }
    
    .ai-input-container {
        padding: 1rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .ask-button {
        width: 100%;
        justify-content: center;
    }
    
    .tool-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .question-header {
        padding: 0.875rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .question-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .expand-indicator {
        font-size: 0.85rem;
    }
    
    .answer-content {
        padding: 1rem;
    }
    
    /* Timer Mobile Styles */
    .timer-display {
        font-size: 2.5rem;
    }
    
    .timer-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .timer-btn {
        width: 100%;
    }
    
    .achievement-progress {
        gap: 0.35rem;
    }
    
    .achievement-slot {
        width: 35px;
        height: 35px;
    }
    
    .achievement-dodecagon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.25rem;
    }
    
    .menu-button {
        height: 100px;
        gap: 0.5rem;
    }
    
    .button-icon {
        font-size: 1.5rem;
    }
    
    .ai-input-container {
        padding: 0.875rem;
    }
    
    .question-header {
        padding: 0.75rem;
    }
    
    .answer-content {
        padding: 0.75rem;
    }
}