/* Binary Calculator Tool Styles */

/* CSS Variables */
:root {
    --primary-color: #329252;
    --primary-hover: #3aa179;
    --secondary-color: #3b82f6;
    --success-color: #059669;
    --error-color: #dc2626;
    --warning-color: #d97706;
    --text-color: #374151;
    --text-light: #6b7280;
    --background-light: #f8fafc;
    --border-color: #e5e7eb;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Tool Container - Full Page Layout */
.binary-calculator-tool {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 0;
    margin: 0;
}

.tool-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.tool-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tool-header h1 i {
    color: var(--primary-color);
    font-size: 2rem;
}

.tool-description {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 0;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Calculator Interface */
.calculator-interface {
    margin-bottom: 3rem;
}

.calculator-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    
}

/* Display Section */
.display-section {
    margin-bottom: 2rem;
}

.display-container {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border-radius: 12px;
    padding: 1.5rem;
    color: var(--white);
}

.display-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.display-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

.display-label.decimal {
    color: #60a5fa;
}

.display-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.binary-display,
.decimal-display {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    text-align: right;
    transition: all 0.2s ease-in-out;
}

.binary-display {
    color: #86efac;
}

.decimal-display {
    color: #60a5fa;
}

.display-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #9ca3af;
}

.operation-display {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.bit-length {
    font-weight: 600;
    color: #fbbf24;
}

/* Mode Selection */
.mode-section {
    margin-bottom: 2rem;
}

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: var(--background-light);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.mode-tab {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mode-tab:hover {
    background: rgba(50, 146, 109, 0.1);
    color: var(--primary-color);
}

.mode-tab.active {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.mode-tab i {
    font-size: 1rem;
}

/* Calculator Buttons */
.calculator-buttons {
    margin-bottom: 2rem;
}

.button-grid {
    display: grid;
    gap: 0.75rem;
}

.arithmetic-grid,
.bitwise-grid {
    grid-template-columns: repeat(4, 1fr);
}

.calc-btn {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    box-shadow: var(--shadow-sm);
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.digit-btn {
    background: linear-gradient(135deg, #f3f4f6 0%, #ffffff 100%);
    color: var(--text-color);
    font-size: 1.5rem;
}

.digit-btn:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #f9fafb 100%);
    border-color: var(--primary-color);
}

.operator-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--white);
    border-color: var(--primary-color);
}

.operator-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1f5f3f 100%);
}

.equals-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #1d4ed8 100%);
    color: var(--white);
    border-color: var(--secondary-color);
    grid-column: span 1;
}

.equals-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.clear-btn {
    background: linear-gradient(135deg, var(--error-color) 0%, #b91c1c 100%);
    color: var(--white);
    border-color: var(--error-color);
}

.clear-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.utility-btn {
    background: linear-gradient(135deg, var(--warning-color) 0%, #b45309 100%);
    color: var(--white);
    border-color: var(--warning-color);
}

.utility-btn:hover {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
}

/* Converter Mode */
.converter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.converter-section {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.converter-input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.converter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.converter-label i {
    color: var(--primary-color);
}

.converter-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--white);
    transition: all 0.2s ease-in-out;
    font-family: 'Courier New', monospace;
}

.converter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(50, 146, 109, 0.1);
}

.convert-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.convert-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Error Message */
.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--error-color);
    font-weight: 500;
    animation: fadeInScale 0.3s ease-out;
}

.error-message i {
    font-size: 1.25rem;
    color: var(--error-color);
}

/* Result Section */
.result-section {
    background: linear-gradient(135deg, #dcfce7 0%, #c9f4fc 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid #86efac;
    animation: fadeInScale 0.5s ease-out;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.copy-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.copy-btn.copied {
    background: var(--success-color);
}

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

.result-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-formats {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
    display: grid;
    gap: 0.75rem;
}

.format-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.format-item:last-child {
    border-bottom: none;
}

.format-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-label i {
    color: var(--text-light);
    font-size: 0.75rem;
}

.format-value {
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    word-break: break-all;
    text-align: right;
    max-width: 60%;
}

/* Calculation Steps */
.calculation-steps {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    animation: fadeInScale 0.5s ease-out;
}

.steps-header {
    margin-bottom: 1rem;
}

.steps-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.steps-header i {
    color: var(--secondary-color);
}

.steps-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.2s ease-in-out;
}

.step-item:hover {
    box-shadow: var(--shadow-sm);
}

.step-number {
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-description {
    font-size: 0.875rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.step-calculation {
    font-family: 'Courier New', monospace;
    background: var(--background-light);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

/* Examples Section */
.examples-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    
}

.examples-header {
    text-align: center;
    margin-bottom: 2rem;
}

.examples-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.examples-header h3 i {
    color: var(--warning-color);
}

.examples-header p {
    color: var(--text-light);
    margin: 0;
}

.examples-grid {
    display: grid;
    gap: 2rem;
}

.example-category {
    background: var(--background-light);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.example-category h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

.example-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.example-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
}

.example-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.example-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.example-input {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.example-output {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Reference Section */
.reference-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.reference-header {
    text-align: center;
    margin-bottom: 2rem;
}

.reference-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.reference-header h3 i {
    color: var(--secondary-color);
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.reference-card {
    background: var(--background-light);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.reference-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

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

.reference-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-color);
}

.reference-card li:last-child {
    border-bottom: none;
}

.reference-card strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* SEO Content */
.seo-content {
    max-width: 800px;
    margin: 3rem auto 0;
    padding: 0 2rem;
    color: var(--text-color);
    line-height: 1.7;
}

.seo-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.seo-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.seo-content p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.seo-content ul,
.seo-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.seo-content strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Animations */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.calc-btn:active {
    animation: buttonPress 0.1s ease-in-out;
}

/* Focus styles for accessibility */
.calc-btn:focus,
.mode-tab:focus,
.convert-btn:focus,
.copy-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.binary-display:focus,
.decimal-display:focus,
.converter-input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Related Tools Section */
.related-tools-section {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 900px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.related-tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.related-tools-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tools-header h3 i {
    color: var(--primary-color);
}

.related-tools-header p {
    color: var(--text-light);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.related-tool-link {
    background: linear-gradient(135deg, var(--background-light) 0%, var(--white) 100%);
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.related-tool-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.related-tool-link i {
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .tool-header h1 {
        font-size: 1.75rem;
    }

    .tool-description {
        font-size: 1rem;
    }

    .display-main {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .binary-display,
    .decimal-display {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .mode-tabs {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .mode-tab {
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    .arithmetic-grid,
    .bitwise-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .calc-btn {
        padding: 1rem;
        font-size: 1rem;
        min-height: 50px;
    }

    .converter-grid {
        gap: 1rem;
    }

    .converter-section {
        padding: 1rem;
    }

    .example-items {
        grid-template-columns: 1fr;
    }

    .reference-grid {
        grid-template-columns: 1fr;
    }

    .seo-content {
        padding: 0 1rem;
    }

    .related-tools-section {
        padding: 1.5rem;
        margin: 1.5rem 1rem;
    }

    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .related-tool-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 4px;
    }

    .related-tool-link i {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .tool-container {
        padding: 0.5rem;
    }

    .calculator-card {
        padding: 1rem;
        border-radius: 8px;
    }

    .tool-header h1 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .display-container {
        padding: 1rem;
    }

    .arithmetic-grid,
    .bitwise-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .calc-btn {
        padding: 0.75rem;
        font-size: 0.875rem;
        min-height: 45px;
    }

    .format-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .format-value {
        max-width: 100%;
        text-align: left;
    }

    .related-tools-section {
        padding: 1rem;
        margin: 1rem 0.5rem;
    }

    .related-tools-grid {
        grid-template-columns: 1fr;
    }

    .related-tool-link {
        flex-direction: row;
        gap: 8px;
        justify-content: flex-start;
        text-align: left;
    }
}

/* Print Styles */
@media print {
    .binary-calculator-tool {
        background: white;
    }

    .calculator-card,
    .examples-section,
    .reference-section {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .calc-btn,
    .mode-tab,
    .convert-btn,
    .copy-btn {
        display: none;
    }
}
