/**
 * Grammar Master - Main Styles
 */

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

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes progressFill {
    from { width: 0; }
}

/* Reset and Base */
#grammar-master-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    line-height: 1.6;
}

#grammar-master-app * {
    box-sizing: border-box;
}

/* Section Items */
.gm-section-item {
    display: grid;
    grid-template-columns: 200px 1fr 80px;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.gm-section-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.gm-section-name {
    font-weight: bold;
    color: #333;
    font-size: 1.1em;
}

/* Progress Bars */
.gm-progress-bar {
    background: #e0e0e0;
    height: 25px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.gm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9em;
    animation: progressFill 1s ease;
}

.gm-progress-fill:empty::after {
    content: '';
}

/* Topic Items */
.gm-topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease;
}

.gm-topic-item:hover {
    border-color: #667eea;
    background: #f9f9ff;
    transform: translateX(5px);
}

.gm-topic-item.completed {
    background: #f0fff4;
    border-color: #38f9d7;
}

.gm-topic-item.completed:hover {
    background: #e0fff0;
}

.gm-topic-status {
    font-size: 1.5em;
}

/* Buttons */
.gm-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.gm-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.gm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.gm-btn-primary:active {
    transform: translateY(0);
}

.gm-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.gm-btn-secondary:hover {
    background: #e0e0e0;
}

.gm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.gm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.gm-modal-content {
    background: white;
    max-width: 900px;
    margin: 50px auto;
    border-radius: 15px;
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.gm-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gm-modal-header h2 {
    margin: 0;
    font-size: 1.8em;
}

.gm-modal-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-modal-header button:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.gm-modal-body {
    padding: 30px;
}

/* Questions */
.gm-question-item {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease;
}

.gm-question-text {
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1em;
}

.gm-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gm-option {
    display: block;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-option:hover {
    border-color: #667eea;
    background: #f9f9ff;
    transform: translateX(5px);
}

.gm-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.gm-option.correct {
    background: #d4edda;
    border-color: #28a745;
    animation: pulse 0.5s ease;
}

.gm-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.gm-option.correct input[type="radio"],
.gm-option.incorrect input[type="radio"] {
    pointer-events: none;
}

.gm-explanation {
    margin-top: 10px;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    border-radius: 5px;
    font-size: 0.95em;
    animation: fadeIn 0.5s ease;
}

.gm-explanation strong {
    display: block;
    margin-bottom: 5px;
}

/* Notes Section */
.gm-notes-section {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.gm-notes-section h3 {
    color: #667eea;
    margin-top: 0;
}

.gm-notes-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

/* Circular Progress */
.gm-circular-progress {
    position: relative;
    width: 200px;
    height: 200px;
}

.gm-circular-progress svg {
    transform: rotate(-90deg);
}

.gm-circular-progress circle {
    transition: stroke-dashoffset 1s ease;
}

/* Weak Areas */
.gm-weak-area-card {
    padding: 20px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-weak-area-card:hover {
    background: #ffe69c;
    transform: translateX(5px);
}

/* Quiz Results */
#gm-quiz-results {
    animation: fadeIn 0.5s ease;
}

/* Responsive Design */
@media (max-width: 992px) {
    .gm-modal-content {
        margin: 20px;
    }

    #grammar-master-app {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .gm-section-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gm-header h1 {
        font-size: 1.8em !important;
    }

    .gm-modal-content {
        margin: 10px;
    }

    .gm-modal-body {
        padding: 20px;
    }

    .gm-circular-progress {
        width: 150px;
        height: 150px;
    }

    .gm-circular-progress svg {
        width: 150px;
        height: 150px;
    }

    #gm-overall-percentage {
        font-size: 2em !important;
    }

    .gm-option {
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    #grammar-master-app {
        padding: 10px;
    }

    .gm-header {
        padding: 25px !important;
    }

    .gm-header h1 {
        font-size: 1.5em !important;
    }

    .gm-btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .gm-modal-header h2 {
        font-size: 1.3em;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .gm-dark-mode #grammar-master-app {
        color: #e0e0e0;
    }

    .gm-dark-mode .gm-section-item,
    .gm-dark-mode .gm-topic-item {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .gm-dark-mode .gm-section-name {
        color: #e0e0e0;
    }

    .gm-dark-mode .gm-modal-content {
        background: #1a1a1a;
    }

    .gm-dark-mode .gm-modal-body {
        color: #e0e0e0;
    }

    .gm-dark-mode .gm-question-item {
        background: #2a2a2a;
    }

    .gm-dark-mode .gm-option {
        background: #1a1a1a;
        border-color: #444;
        color: #e0e0e0;
    }

    .gm-dark-mode .gm-notes-section {
        background: #2a2a2a;
    }

    .gm-dark-mode textarea {
        background: #1a1a1a;
        border-color: #444;
        color: #e0e0e0;
    }
}

/* Print Styles */
@media print {
    .gm-header,
    .gm-btn,
    .gm-modal-header button,
    .gm-notes-section {
        display: none !important;
    }

    .gm-modal {
        position: static;
        background: white;
    }

    .gm-modal-content {
        box-shadow: none;
        max-height: none;
    }

    .gm-option {
        break-inside: avoid;
    }
}

/* Loading State */
.gm-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.gm-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Empty State */
.gm-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.gm-empty-state svg,
.gm-empty-state .icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Success Checkmark Animation */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.gm-checkmark {
    animation: checkmark 0.5s ease-in-out;
}

/* Confetti Animation */
@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

.gm-confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #667eea;
    animation: confetti-fall 3s linear;
    pointer-events: none;
}
