:root {
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --primary-bg: #eef2ff;
    --accent: #06b6d4;
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Calculator Wrapper */
.and-calculator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Cards */
.input-card,
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 28px;
    transition: var(--transition);
}

.input-card:hover {
    box-shadow: var(--shadow-medium);
}

.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 20px;
    align-self: start;
}

/* Card Header */
.card-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.result-card .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.result-card .card-title {
    color: white;
}

.card-description {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.result-card .card-description {
    color: rgba(255, 255, 255, 0.9);
}

/* Input Group */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--text-main);
    transition: var(--transition);
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.input-field::placeholder {
    color: var(--text-light);
}

.input-preview {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    padding: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius);
    font-size: 13px;
}

.preview-item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.preview-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-value {
    color: var(--text-main);
    font-weight: 700;
    
    font-size: 14px;
}

/* Buttons */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.button-group-secondary {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

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

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--border);
    text-transform: none;
    letter-spacing: normal;
    padding: 10px 16px;
    font-size: 14px;
}

.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
    transform: translateY(-2px);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    text-transform: none;
    letter-spacing: normal;
    padding: 8px 12px;
    font-size: 14px;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-dark);
    background: var(--primary-bg);
    text-decoration: none;
}

/* Result Card Styles */
.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.result-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 20px;
    word-break: break-word;
    background: rgba(255, 255, 255, 0.15);
    padding: 16px;
    border-radius: var(--radius);
    
    min-height: 60px;
    display: flex;
    align-items: center;
}

.result-details {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.result-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.result-detail-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.detail-label {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

.detail-value {
    font-size: 16px;
    font-weight: 700;
    
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-icon {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

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

/* Steps Section */
.steps-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-soft);
}

.steps-content {
    background: var(--surface-muted);
    border-radius: var(--radius);
    padding: 20px;
    
    font-size: 14px;
    line-height: 1.8;
}

.step-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.step-row:last-child {
    border-bottom: none;
}

.step-row.highlight {
    background: var(--primary-bg);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 4px 0;
}

/* Truth Table Section */
.truth-table-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-soft);
}

.section-header {
    margin-bottom: 24px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.section-description {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.table-wrapper {
    overflow-x: auto;
}

.truth-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.truth-table thead {
    background: var(--primary);
    color: white;
}

.truth-table th {
    padding: 14px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.truth-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.truth-table tbody tr:last-child {
    border-bottom: none;
}

.truth-table tbody tr:hover {
    background: var(--surface-muted);
}

.truth-table td {
    padding: 14px 20px;
    text-align: center;
    color: var(--text-main);
    font-weight: 600;
    font-size: 16px;
    
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
    max-width: 320px;
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Mobile Responsive */
@media (max-width: 992px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .result-card {
        position: relative;
        top: 0;
    }
}

@media (max-width: 767px) {
    .input-card,
    .result-card {
        padding: 20px;
    }

    .card-title {
        font-size: 20px;
    }

    .input-field {
        font-size: 14px;
        padding: 12px 14px;
    }

    .input-preview {
        flex-direction: column;
        gap: 8px;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .button-group-secondary {
        flex-direction: column;
    }

    .btn {
        padding: 14px 20px;
        font-size: 14px;
    }

    .result-value {
        font-size: 18px;
        padding: 12px;
    }

    .steps-section,
    .truth-table-section {
        padding: 20px;
    }

    .truth-table th,
    .truth-table td {
        padding: 10px 12px;
        font-size: 14px;
    }

    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
