/**
 * Interactive Abacus CSS
 * CalcTechLab.com
 * Beautiful, educational, and interactive design
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.abacus-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.abacus-header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: fadeInDown 0.6s ease;
}

.abacus-header p {
    font-size: 1.2rem;
    opacity: 0.95;
    animation: fadeInUp 0.6s ease;
}

/* Main Content Grid */
.abacus-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-bottom: 30px;
}

/* Abacus Card */
.abacus-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeIn 0.8s ease;
}

/* Abacus Controls */
.abacus-controls {
    padding: 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.abacus-mode {
    display: flex;
    gap: 10px;
}

.mode-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: white;
    color: #2563eb;
    border-color: white;
}

.abacus-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Display */
.abacus-display {
    background: #1e293b;
    padding: 30px;
    text-align: center;
}

.display-label {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.display-value {
    font-size: 3.5rem;
    font-weight: 300;
    color: white;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
}

/* Abacus Frame */
.abacus-frame {
    padding: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
}

.abacus-container {
    background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Abacus Rods */
.abacus-rods {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    position: relative;
}

.abacus-rod {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.rod-label {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
}

.rod-line {
    width: 4px;
    height: 400px;
    background: linear-gradient(180deg, #d4af37 0%, #b8860b 100%);
    border-radius: 2px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Heaven Section (Top) */
.heaven-section {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
}

/* Earth Section (Bottom) */
.earth-section {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 10px;
}

/* Divider Bar */
.divider-bar {
    position: absolute;
    top: 130px;
    left: -20px;
    right: -20px;
    height: 8px;
    background: linear-gradient(90deg, #654321 0%, #8b4513 50%, #654321 100%);
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

/* Beads */
.bead {
    width: 50px;
    height: 35px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    margin: 5px 0;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                background 0.3s ease,
                box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.bead:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.bead.dragging {
    cursor: grabbing;
    z-index: 100;
    opacity: 0.9;
}

.bead.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.5);
}

.bead.heaven {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.bead.heaven.active {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Sidebar */
.abacus-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Info Card */
.info-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeInRight 0.8s ease;
}

.info-card h3 {
    color: #2563eb;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card p {
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 10px;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    color: #64748b;
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.info-card li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

/* Quick Guide */
.quick-guide {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #2563eb;
}

.quick-guide h3 {
    color: #1e40af;
}

.quick-guide p {
    color: #1e40af;
}

/* Features Grid */
.features-section {
    margin-top: 30px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.feature-card h3 {
    color: #2563eb;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.feature-card p {
    color: #64748b;
    line-height: 1.6;
}

/* SEO Content Section */
.seo-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 30px;
}

.seo-content h2 {
    color: #2563eb;
    margin-bottom: 20px;
    font-size: 2rem;
}

.seo-content h3 {
    color: #1e40af;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.seo-content h4 {
    color: #2563eb;
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.seo-content p {
    color: #64748b;
    line-height: 1.8;
    margin-bottom: 15px;
}

.seo-content ul, .seo-content ol {
    color: #64748b;
    line-height: 1.8;
    margin-bottom: 15px;
    padding-left: 30px;
}

.seo-content li {
    margin-bottom: 8px;
}

.seo-content strong {
    color: #1e40af;
}

/* History Timeline */
.history-timeline {
    position: relative;
    padding-left: 40px;
    margin: 30px 0;
}

.timeline-item {
    position: relative;
    padding-bottom: 30px;
}

.timeline-item:before {
    content: "";
    position: absolute;
    left: -32px;
    top: 5px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #2563eb;
    border: 3px solid white;
    box-shadow: 0 0 0 3px #2563eb;
}

.timeline-item:after {
    content: "";
    position: absolute;
    left: -25px;
    top: 20px;
    width: 2px;
    height: calc(100% - 10px);
    background: #e2e8f0;
}

.timeline-item:last-child:after {
    display: none;
}

.timeline-date {
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 5px;
}

.timeline-content {
    color: #64748b;
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .abacus-content {
        grid-template-columns: 1fr;
    }
    
    .abacus-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .abacus-header h1 {
        font-size: 2rem;
    }
    
    .abacus-header p {
        font-size: 1rem;
    }
    
    .display-value {
        font-size: 2.5rem;
    }
    
    .abacus-frame {
        padding: 20px;
    }
    
    .abacus-container {
        padding: 20px;
    }
    
    .abacus-rods {
        gap: 8px;
    }
    
    .bead {
        width: 40px;
        height: 28px;
    }
    
    .rod-line {
        height: 350px;
    }
    
    .abacus-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .abacus-mode,
    .abacus-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .abacus-header h1 {
        font-size: 1.6rem;
    }
    
    .display-value {
        font-size: 2rem;
    }
    
    .abacus-rods {
        gap: 5px;
    }
    
    .bead {
        width: 35px;
        height: 25px;
    }
    
    .rod-line {
        height: 300px;
        width: 3px;
    }
    
    .rod-label {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .abacus-controls,
    .abacus-actions {
        display: none;
    }
}
/* Help Modal */
.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.help-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
}

.help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: #ef4444;
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.help-close:hover {
    background: #dc2626;
    transform: rotate(90deg);
}

.help-body {
    padding: 50px 40px 40px;
    text-align: center;
}

.help-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

.help-body h2 {
    color: #2563eb;
    font-size: 2rem;
    margin-bottom: 20px;
}

.help-body #help-text {
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
    text-align: left;
}

.help-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.help-btn {
    padding: 12px 24px;
    border: 2px solid #2563eb;
    background: white;
    color: #2563eb;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.help-btn:hover:not(:disabled) {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
}

.help-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.help-btn-primary {
    background: #2563eb;
    color: white;
}

.help-btn-primary:hover {
    background: #1e40af;
}

.help-progress {
    color: #64748b;
    font-weight: 600;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Mobile Help Modal */
@media (max-width: 768px) {
    .help-body {
        padding: 40px 25px 25px;
    }
    
    .help-icon {
        font-size: 3rem;
    }
    
    .help-body h2 {
        font-size: 1.5rem;
    }
    
    .help-body #help-text {
        font-size: 1rem;
    }
    
    .help-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .help-btn {
        width: 100%;
    }
}
