/**
 * ConvMaster - Standard Calculator Styles
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}

.tool-header__icon .icon--blue {
    background: rgba(59, 130, 246, 0.15);
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =====================================================
   CURRENT DATE BANNER
   ===================================================== */
.current-date-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.current-date-banner__icon {
    font-size: 1.25rem;
}

.current-date-banner__text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* =====================================================
   CALCULATOR WIDGET
   ===================================================== */
.calc-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* =====================================================
   TOOLBAR
   ===================================================== */
.calc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    flex-wrap: wrap;
    gap: 1rem;
}

.calc-toolbar__left,
.calc-toolbar__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Design Selector */
.design-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.design-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.design-buttons {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

.design-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.design-btn:hover {
    background: var(--bg-tertiary);
}

.design-btn.active {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Popup Button */
.btn-popup {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-popup:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.btn-popup__icon {
    font-size: 1rem;
}

/* =====================================================
   CALCULATOR CONTAINER
   ===================================================== */
.calc-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 0;
    min-height: 500px;
}

/* =====================================================
   CALCULATOR
   ===================================================== */
.calculator {
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* Display */
.calc-display {
    position: relative;
    background: #1a1a2e;
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    min-height: 100px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    overflow: hidden;
    box-sizing: border-box;
}

.calc-display__expression {
    font-size: 0.95rem;
    color: #888;
    min-height: 1.4em;
    word-break: break-all;
    text-align: right;
    width: 100%;
    margin-bottom: 0.25rem;
}

.calc-display__result {
    font-size: 2.75rem;
    font-weight: 700;
    color: #fff;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    line-height: 1.2;
    word-break: break-all;
    text-align: right;
    width: 100%;
}

.calc-display__result.error {
    color: #ef4444;
    font-size: 1.5rem;
}

.calc-display__memory {
    position: absolute;
    top: 0.5rem;
    left: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

/* Keypad */
.calc-keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    width: 100%;
}

/* Keys */
.calc-key {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    min-width: 56px;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.calc-key:active {
    transform: scale(0.95);
}

/* Number Keys */
.calc-key--number {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.calc-key--number:hover {
    background: var(--bg-secondary);
}

/* Operator Keys */
.calc-key--operator {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.calc-key--operator:hover {
    background: rgba(59, 130, 246, 0.25);
}

.calc-key--operator.active {
    background: #3b82f6;
    color: #fff;
}

/* Memory Keys */
.calc-key--memory {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-size: 0.9rem;
}

.calc-key--memory:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* Clear Keys */
.calc-key--clear {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.calc-key--clear:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Function Keys */
.calc-key--function {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.calc-key--function:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Equals Key */
.calc-key--equals {
    background: #3b82f6;
    color: #fff;
    border: none;
}

.calc-key--equals:hover {
    background: #2563eb;
}

/* =====================================================
   DESIGN VARIATIONS
   ===================================================== */

/* Modern Design */
.calculator[data-design="modern"] .calc-display {
    background: linear-gradient(135deg, #1e3a5f, #2d1b4e);
    border-radius: 20px;
}

.calculator[data-design="modern"] .calc-key {
    border-radius: 16px;
}

.calculator[data-design="modern"] .calc-key--number {
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-secondary));
    box-shadow: 3px 3px 6px rgba(0,0,0,0.1), -2px -2px 5px rgba(255,255,255,0.05);
    border: none;
}

.calculator[data-design="modern"] .calc-key--equals {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

/* Retro Design */
.calculator[data-design="retro"] {
    background: #2a2a2a;
    padding: 1.5rem;
    border-radius: 8px;
    border: 3px solid #444;
}

.calculator[data-design="retro"] .calc-display {
    background: #0a2a0a;
    border: 2px inset #333;
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.1);
}

.calculator[data-design="retro"] .calc-display__result {
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    font-family: 'VT323', 'Courier New', monospace;
}

.calculator[data-design="retro"] .calc-display__expression {
    color: #00aa00;
}

.calculator[data-design="retro"] .calc-display__memory {
    color: #00ff00;
    background: transparent;
}

.calculator[data-design="retro"] .calc-key {
    border-radius: 4px;
    box-shadow: 2px 2px 0 #111;
    border: 1px solid #555;
}

.calculator[data-design="retro"] .calc-key--number {
    background: #3a3a3a;
    color: #fff;
}

.calculator[data-design="retro"] .calc-key--operator {
    background: #4a3000;
    color: #ffa500;
    border-color: #ffa500;
}

.calculator[data-design="retro"] .calc-key--memory {
    background: #2a2a4a;
    color: #aaaaff;
}

.calculator[data-design="retro"] .calc-key--clear {
    background: #4a0000;
    color: #ff6666;
}

.calculator[data-design="retro"] .calc-key--equals {
    background: #005500;
    color: #00ff00;
}

/* Minimal Design */
.calculator[data-design="minimal"] .calc-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.calculator[data-design="minimal"] .calc-display__result {
    color: var(--text-primary);
}

.calculator[data-design="minimal"] .calc-display__expression {
    color: var(--text-secondary);
}

.calculator[data-design="minimal"] .calc-key {
    border-radius: 8px;
    border: none;
    background: transparent;
}

.calculator[data-design="minimal"] .calc-key:hover {
    background: var(--bg-tertiary);
}

.calculator[data-design="minimal"] .calc-key--number,
.calculator[data-design="minimal"] .calc-key--function {
    color: var(--text-primary);
}

.calculator[data-design="minimal"] .calc-key--operator {
    background: transparent;
}

.calculator[data-design="minimal"] .calc-key--equals {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* =====================================================
   HISTORY PANEL
   ===================================================== */
.calc-history {
    border-left: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
}

.calc-history__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.calc-history__header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-clear-history {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.btn-clear-history:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

.calc-history__list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    max-height: 400px;
}

.calc-history__empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.history-item__expression {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.history-item__result {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Consolas', monospace;
}

/* =====================================================
   KEYBOARD SHORTCUTS
   ===================================================== */
.keyboard-shortcuts {
    margin: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.keyboard-shortcuts summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
}

.keyboard-shortcuts summary::-webkit-details-marker {
    display: none;
}

.keyboard-shortcuts summary::after {
    content: '▸';
    margin-left: auto;
    transition: transform 0.2s ease;
}

.keyboard-shortcuts[open] summary::after {
    transform: rotate(90deg);
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

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

.shortcut kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shortcut span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =====================================================
   INFO NOTICE
   ===================================================== */
.calc-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    margin: 0 1.5rem 1.5rem;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.calc-info span {
    font-size: 1rem;
}

.calc-info p {
    margin: 0;
    line-height: 1.5;
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

.tool-section > p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.feature-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.feature-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
}

.step-card__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.step-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.25rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* =====================================================
   HIDDEN STATE
   ===================================================== */
[hidden] {
    display: none !important;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .calc-container {
        grid-template-columns: 1fr;
    }
    
    .calc-history {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .calc-history__list {
        max-height: 200px;
    }
}

@media (max-width: 640px) {
    .tool-page {
        padding: 1rem;
    }
    
    .tool-header {
        flex-direction: column;
        text-align: center;
    }
    
    .tool-header__text h1 {
        font-size: 1.5rem;
    }
    
    .calc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .calc-toolbar__left,
    .calc-toolbar__right {
        justify-content: center;
    }
    
    .calculator {
        padding: 1rem;
    }
    
    .calc-display__result {
        font-size: 2rem;
    }
    
    .calc-key {
        height: 50px;
        font-size: 1.1rem;
    }
    
    .calc-keypad {
        gap: 0.375rem;
    }
    
    .btn-popup__text {
        display: none;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid,
    .steps-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .design-selector label {
        display: none;
    }
    
    .calc-key {
        height: 45px;
        font-size: 1rem;
    }
    
    .calc-key--memory {
        font-size: 0.8rem;
    }
}

/* =====================================================
   POPUP WINDOW STYLES
   ===================================================== */
.popup-calculator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    min-width: 320px;
}

.popup-calculator__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: move;
}

.popup-calculator__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.popup-calculator__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.popup-calculator__close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.popup-calculator .calculator {
    max-width: none;
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

/* Dark theme specific */
[data-theme="dark"] .calculator[data-design="minimal"] .calc-display {
    background: #1a1a2e;
}

[data-theme="dark"] .calculator[data-design="minimal"] .calc-display__result {
    color: #fff;
}
