/* Reset and Base Styles */
.sigfigs-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.5;
    color: #333;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: white;
}

.sigfigs-container {
    width: 100%;
}

/* Header */
.sig-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.sig-header h2 {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

/* Main Layout */
.sig-main-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.sig-input-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sig-calculator-section {
    flex: 1;
    min-width: 400px;
    padding: 20px;
        background: #f8f9fa;
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

/* Input Container */
.sig-input-container {
    margin-bottom: 0;
}

.sig-input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    margin-bottom: 20px;
    font-family: 'Roboto Mono', monospace;
    border: 2px solid #4a90e2;
    border-radius: 14px;
    background: white;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.sig-input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.sig-input-hint {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
    padding-left: 5px;
}

/* Round Control */
.sig-round-control {
    background: #f8f9fa;
    border-radius: 14px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.sig-figures-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sig-figures-other {
    display: flex;
    align-items: center;
    gap: 10px;
    /*flex-wrap: wrap;*/
}

.sig-round-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

input[type=number].sig-fig-input {
    width: 100px;
    padding: 10px 12px;
    font-size: 16px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    background: white;
    margin-left: 10px;
    color: #495057;
    text-align: center;
    transition: all 0.3s;
}

.sig-fig-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.sig-fig-input::-webkit-outer-spin-button,
.sig-fig-input::-webkit-inner-spin-button {
    /* -webkit-appearance: none; */
    margin: 0;
}

/* Calculator Keyboard */
.sig-keyboard {
    height: fit-content;
}

.sig-keyboard-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.sig-keyboard-row:last-child {
    margin-bottom: 0;
}

.sig-keyboard-row-last {
    grid-template-columns: repeat(4, 1fr);
}

.sig-key {
    padding: 15px 10px;
    font-size: 18px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 12px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 55px;
    user-select: none;
}

.sig-key:hover {
    background: #f0f0f0;
    color: #000;
    /*transform: translateY(-2px);*/
}

.sig-key:active {
    transform: translateY(0);
}

.sig-key.num {
    background: #f8f8f8;
    font-weight: 600;
}

.sig-key.op {
    background: #e8e8e8;
    font-weight: 600;
}

.sig-key.func {
    background: #e0e8ff;
    font-weight: 600;
}

.sig-key.const {
    background: #ffe0e0;
    font-weight: 600;
}

.sig-key.paren {
    background: #fff0e0;
    font-weight: 600;
}

.sig-func.clear {
    background: #ffcccc;
    font-weight: 600;
}

.sig-func.back {
    background: #cccccc;
    font-weight: 600;
}

.sig-key.solve {
    background: #ccffcc;
    font-weight: 600;
    /* grid-column: span 2; */
}

/* Results Container */
.sig-results-container {
    background: white;
    border-radius: 20px;
    padding: 25px;
    display: none;
    border: 2px solid #e9ecef;
    position: relative;
    min-height: 200px;
}

/* Loading */
.sig-loading {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sig-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-bottom: 20px;
}

.sig-spinner:after {
    content: " ";
    display: block;
    width: 32px;
    height: 32px;
    margin: 4px;
    border-radius: 50%;
    border: 3px solid #4a90e2;
    border-color: #4a90e2 transparent #4a90e2 transparent;
    animation: sig-spin 1.2s linear infinite;
}

@keyframes sig-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results List */
.sig-results ol {
    list-style: none;
    counter-reset: step-counter;
    padding-left: 0;
    margin: 0;
}

.sig-results li {
    counter-increment: step-counter;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    font-family: 'Roboto Mono', monospace;
    font-size: 16px;
    line-height: 1.6;
    position: relative;
    padding-left: 30px;
}

.sig-results li:before {
    content: counter(step-counter) ".";
    font-weight: bold;
    margin-right: 10px;
    color: #666;
    position: absolute;
    left: 0;
    top: 12px;
}

.sig-results li:last-child {
    border-bottom: none;
    padding-bottom: 0;
    background: #fffdf6;
    border: 2px solid #ffd54f;
    border-radius: 14px;
    padding: 20px;
    margin: 20px 0 0 0;
}

.sig-results li:last-child:before {
    display: none;
}

/* Copy Icons */
.sig-copy-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
    opacity: 0.7;
    transition: all 0.3s ease;
    position: relative;
}

.sig-copy-icon:hover {
    opacity: 1;
}

.sig-copy-icon.shaking {
    animation: shakeIcon 0.5s ease-in-out;
}

.sig-copy-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #0b3700;
    stroke-width: 35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Solution Copy Icon */
.sig-solution-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
    opacity: 0.7;
    transition: all 0.3s ease;
    position: relative;
}

.sig-solution-copy:hover {
    opacity: 1;
}

.sig-solution-copy.shaking {
    animation: shakeIcon 0.5s ease-in-out;
}

.sig-solution-copy svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #0b3700;
    stroke-width: 35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Scientific Notation */
.sig-scientific {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

/* Error Messages */
.sig-error {
    color: #e74c3c;
    padding: 20px;
    text-align: center;
    background: #fdf2f2;
    border-radius: 8px;
    border: 2px solid #fadbd8;
    margin: 10px 0;
    font-size: 16px;
}

/* Animation for shaking icons */
@keyframes shakeIcon {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sig-main-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .sig-input-section,
    .sig-calculator-section {
        min-width: 100%;
        width: 100%;
    }
    
    .sig-keyboard-row {
        gap: 8px;
    }
    
    .sig-key {
        padding: 12px 8px;
        font-size: 16px;
        min-height: 45px;
    }
    
    .sig-results-container {
        padding: 15px;
    }
    
    .sig-results li {
        font-size: 14px;
        padding-left: 25px;
    }
    
    .sig-input {
        font-size: 16px;
        padding: 12px;
    }
    
    .sig-figures-other {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .sig-fig-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sigfigs-wrapper {
        /*padding: 10px;*/
    }
    
    .sig-key {
        padding: 10px 6px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .sig-header h2 {
        font-size: 24px;
    }
    
    .sig-fig-input {
        padding: 8px;
        font-size: 14px;
    }
}